-
Notifications
You must be signed in to change notification settings - Fork 96
fixing the base64 garbage processing #791
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
|
||
simdutf_really_inline const char *find(const char *start, const char *end, | ||
char character) noexcept { | ||
for (; std::distance(start, end) >= 64; start += 64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Std::distance has a O(N) complexity avoid calling it will improve performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that, in this instance, it is constant time because a pointer is a "LegacyRandomAccessIterator".
https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator
I believe that it is even applies to cases like this...
std::vector<X> v =....
return std::distance(v.begin(), v.end());
It is possible that an alternative coding could improve performance in some cases. I am not sure.
I am going to merge. Thanks @anonrig and @pauldreik for the review. |
The convention is Node.js is that lenient processing stops with the first '=' character. Thus we have
The current fix is suboptimal: I look for the first occurence of
=
using std::find. We should roll our own fast 'find' function.I have coded a fast find function for some kernels.
Fixes #792
Fixes #795