-
Notifications
You must be signed in to change notification settings - Fork 7
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
Design of Str #53
Comments
That is so that each of those optional fields can be dispatched on separately, and the types can be different. For the hash value, it might be a UInt32, or a UInt64, the SubStr might be a UnitRange{UInt16}, which could be useful to have a small table (up to 64KB) of "interned" strings, where each one can be packed into an array using only 16 bytes per string (8 bytes pointer, 4 bytes offset/len, 4 bytes CRC32c). |
OK (but this is the stuff that it makes the package harder to digest 😄). |
Just a short question - I understand that you want |
Apart from the question above I have just realized that
However, when you start allowing |
I've been thinking, since your questions, about another way of handling a "UniStr" type, that might be faster.
0 would indicate ASCII, 1 _Latin, 2 _UCS2, 3 _UTF32 (and those would no longer even be visible) Another idea I had, since I noticed that the beginning of the strings are not nicely aligned, would be to store the hash value for the string in the next 8 bytes (on 64-bit systems), using one of the "type" bits to say if the hash had been calculated. I also have been thinking about another trick, which would be to store short strings with the data field pointing to a known string, that you can check with |
I understand why
Str
needs the internal fields likecache
etc. (100% support 👍) but I do not understand why their types have to be in a signature and not be fixed - what is the value of this flexibility?In short why the signature
struct Str{T} <: AbstractString
is not enough for this type?`
The text was updated successfully, but these errors were encountered: