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

Array data structures should keep their lengths encoded #136

Open
dvanhorn opened this issue Jun 21, 2023 · 0 comments
Open

Array data structures should keep their lengths encoded #136

dvanhorn opened this issue Jun 21, 2023 · 0 comments

Comments

@dvanhorn
Copy link
Member

Our current layout for strings and vectors is to store their unencoded length in the first word, but there's really no good reason doing it this way it and it means you have to re-encode it when you access the length. I think this was originally done to make bounds checking simpler to understand, but it's basically the same encoded or not. Changing this would simplify the code a bit.

Arguably the same should be done for the character data in strings. We have the bits available, so using codepoints doesn't buy you anything except the work of de/re-coding.

It's technically possible to pack 3 codepoints per words (but not chars), but we don't do that.

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

No branches or pull requests

1 participant