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

Serializable representations with leading length #38

Open
k0001 opened this issue Jun 12, 2020 · 1 comment
Open

Serializable representations with leading length #38

k0001 opened this issue Jun 12, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@k0001
Copy link

k0001 commented Jun 12, 2020

This is more of a comment for something to keep in mind in future work, rather than an issue about something that exists now in the code. I mention it now because this potential issue is easier to prevent than to correct afterwards =)

I noticed that in the internal representation for Slist, the size comes after the list itself. This is fine, there's nothing wrong with this in principle. However, when the time comes to implement serializations for values of type Slist x, such as Binary or Serialize or Serialise or ToJSON or whatever, if the serialized representations include the size of the list, please make sure the size comes before the list content, and not after. This can make parsing significantly more performant, since the expected length can be verified before even attempting to parse the entirety of the list.

Cool library!

@vrom911
Copy link
Member

vrom911 commented Jun 21, 2020

That is an interesting point! To be honest I didn't think about that..
I don't mind having the arguments swapped in the library if it could help in the future 🙂

@vrom911 vrom911 added the enhancement New feature or request label Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants