-
Notifications
You must be signed in to change notification settings - Fork 35
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
changed JanetTArrayView to use JanetBuffer #146
changed JanetTArrayView to use JanetBuffer #146
Conversation
Definitely breaking backwards compatibility but IMO worth it. The only issue with the native buffer is a 2GB limit, which may be an issue |
i see, i didnt pay attention about how large the two buffertypes could get... perhaps capa and count could be moved into a struct in a union with a size_t size? (but that would break even more ._.) like so:
disregarding the bad var names, this way the JanetBuffer type could stay the same size. when using it as a string buffer it could behave as before, except accessing count and capa via sizing, and in a typed array it could use the 64bit size. (of course this complicates things i had in mind where you could just write into a buffer and then plug it into a ta-view -.-) (edit: though now i think it would be better to just attach another buffer to the view) as it is now when calling ta/properties, the buffer is always shown as empty since count stays 0. but i would rather only print the first and last couple of bytes (if at all). similar to how large arrays are printed. another thing with potential for bugs (at least in heteroendian (is that even a word? XD) systems/networks): i moved the endianess-holding-flag from buffer to view; perhaps endianess could be resolved on the fly by the view upon access, just like the datatype, this way you could have one buffer and interpret it in many different ways. in this case i would add a function to write a copy of the buffer with the other endianess baked in for a permanent speedup also there is definetly a bug in here, i get kinda random crashes with medium sized tarrays (10k+ doubles) while iterating over multiple such tarrays (read from different sources) in order to compare them. |
have yet to figure this out. the test i added iterates over a table, in this table are 4 identical tarrays, |
A number of issues looking at the code, don't use janet_buffer_init to get a garbage collected buffer. Also things like returning buffer->capacity instead of buffer->count for the buffer length seems wrong |
No description provided.