-
Notifications
You must be signed in to change notification settings - Fork 1.5k
(#2890) - websql: avoid hex() for binaries #2900
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
Conversation
|
re-rebased on #2818 |
|
rebased off master |
|
I also kept the perf improvements from #2899 for hex-parsing, because we're still using hex-parsing for IDs, since those are short and would be kinda nuts to migrate. |
|
+1 when green |
1 similar comment
|
+1 when green |
|
thanks, 2693736 |
|
COBS would be more efficient for preventing embedded nulls. Use a 16-bit version of it, if a null is a |
|
That's interesting! I would want to see a jsperf, though, to confirm that running COBS over strings is faster in most browsers than |
Faster: no. (though comparable, I would think, depending on how string manipulation is implemented.) You can run the COBS algorithm in place; it creates a string with 1 additional byte (or word) in length. More efficient in storage: yes. The thing about replacing unicode |
|
Ah, that's true. I forgot that we're replacing a single character with two characters here. OK, it's worth giving it a shot! :) |
See #2899 for backstory. Rebased on #2818 because I didn't want to bitrot myself.
For a demonstration, compare these two blocks: before and after. The difference should be obvious.
Using
hex()was a nice hack, but decoding hex strings in JavaScript is slow. Apparently just usingreplace()to swap out the\u0000is much faster. I borrowed @neojski's trick from pouch-collate for this.