Conversation
Handle most popular cases in a trie-style, branching on a first character. Remove useless HandleScope which was only eating time without producing any value.
Boosts speed up to 10% on primitive `createHash().update().digest()` benchmark.
|
Whoa replaced all uses of StringBytes in crypto. @bnoordhuis: please take a look. |
|
Ha, just created @iojs/crypto |
|
Oh, forgot to say. Overall improvement is about 15%. |
There was a problem hiding this comment.
You can probably do a little better still by also passing encoding->length(). Then you can filter on length first before you start comparing bytes.
There was a problem hiding this comment.
Also, wouldn't it be cheaper to do the comparison in JS and just pass integers to C++ land? I suspect that the biggest overhead is from the new[]/delete[] calls, not the string comparison.
There was a problem hiding this comment.
I'm +1 for JS-land thing, but for now - let's do it the way it is. encoding->length() doesn't seem to be improving situation much on my benchmarks.
|
LGTM. Left some comments but nothing substantial. |
Handle most popular cases in a trie-style, branching on a first character. Remove useless HandleScope which was only eating time without producing any value. PR-URL: #664 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #664 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Boosts speed up to 10% on primitive `createHash().update().digest()` benchmark. PR-URL: #664 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
|
Speaking of naming, I think |
|
@piscisaureus suggestions? |
|
First of all the To take it a step further, an The current (*) You might argue that the |
|
BTW I think this is a good addition. |
|
@piscisaureus there is no v8 API to do such on-stack allocations. |
|
@piscisaureus oh, we could use |
|
@piscisaureus opened a PR as you suggested #670 |

Right now this is only about
crypto.createHash().update().digest(), but soon will add other methods here if you do not have any objections.cc @bnoordhuis . Btw, would be nice to have @iojs/crypto