Skip to content
This repository was archived by the owner on Nov 15, 2019. It is now read-only.

optimize code representations #13

Open
mndrix opened this issue Jun 17, 2013 · 3 comments
Open

optimize code representations #13

mndrix opened this issue Jun 17, 2013 · 3 comments

Comments

@mndrix
Copy link
Owner

mndrix commented Jun 17, 2013

Codes and lists of codes are both common Prolog data structures. Create internal representations which optimize for this use case. These representations will occupy less memory (the bottleneck in most benchmarks).

Make a Code type which implements the Number interface. It should just be a rune under the hood. The current implementation for integers requires a pointer to a struct which wraps a bool and a slice. A Code type would also be helpful for representing small integers, which are very common in real world code.

Make a CodeList which implements the Callable interface. It should just be a []rune under the hood. Unification with other list terms returns a slice where possible. The current implementation for code lists requires a linked list of terms which adds substantial memory overhead.

@mndrix
Copy link
Owner Author

mndrix commented Aug 29, 2013

Performing arithmetic operations on Code values should upgrade them to standard integers. Codes are almost never used for math. Although perhaps upgrading and repeating on overflow might be better.

@ghost
Copy link

ghost commented Mar 1, 2017

Are you still working on this / have you made any progress?

I've written some helper functions for more compact printing of lists and strings. If you are interested, I could put it into a pull request.

@mndrix
Copy link
Owner Author

mndrix commented Mar 1, 2017

Are you still working on this / have you made any progress?

No. I haven't worked on this issue in quite a while and probably won't return to it in the foreseeable future.

I've written some helper functions for more compact printing of lists and strings. If you are interested, I could put it into a pull request.

Yes please. I've very interested in seeing pull requests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant