Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store arrays more efficiently #29

Closed
Marwes opened this issue Jun 6, 2016 · 0 comments
Closed

Store arrays more efficiently #29

Marwes opened this issue Jun 6, 2016 · 0 comments

Comments

@Marwes
Copy link
Member

Marwes commented Jun 6, 2016

Currently arrays are just stored as Array<Value> which wastes a lot of space as the tag information in the enum is duplicated. A better way would be to have multiple array types (Array, Array, Array and maybe even Array if a byte type were added).

Though the idea is straightforward the implementation may have some subtleties. For instance consider the following code

let twice x = [x, x]
twice 1
twice { x = 1 }

When constructing an array in the twice function the tag of x needs to be inspected so the correct array can be constructed. A similar problem comes when indexing an array where the code has to check the type of the array to construct the correct Value variant. Theses issues aren't to complicated but there may be other problems hiding as well.

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

No branches or pull requests

1 participant