Uh oh!
There was an error while loading. Please reload this page.
buffer: improve fill(number) performance - #31489
Conversation
nodejs-github-bot
commented
Jan 24, 2020
There was a problem hiding this comment.
| constTypedArrayPrototype=ObjectGetPrototypeOf(Uint8Array.prototype); | |
| constUint8ArrayPrototype=ObjectGetPrototypeOf(Uint8Array.prototype); |
Uint8Array.prototype.constructor.name is Uint8Array, not TypedArray.
There was a problem hiding this comment.
This line is correct as-is. The prototype of Uint8Array.prototype is the %TypedArray%.prototype.
There was a problem hiding this comment.
@devsnek is correct, this is the prototype of the prototype, which is TypedArray. The same thing is done in internal/util/types.js.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
039c099 to
aa45188Comparenodejs-github-bot
commented
Jan 24, 2020
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
targos
commented
Jan 24, 2020
I think we could also directly add TypedArray and its prototype to the primordials. I'll do that after this PR. |
aa45188 to
ac9de4fComparenodejs-github-bot
commented
Jan 24, 2020
nodejs-github-bot
commented
Jan 25, 2020
There was a problem hiding this comment.
Future enhancement: res < 0 is sometimes a coercion-to-nan, sometimes not because bindingFill() returns either undefined or a number.
Changing Fill() in node_buffer.cc to always return a number is probably beneficial for performance.
nodejs-github-bot
commented
Jan 26, 2020
PR-URL: nodejs#31489 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
ac9de4f to
59cba9aComparenodejs-github-bot
commented
Jan 27, 2020
Trott
commented
Jan 27, 2020
This seems to have landed without first getting a clean CI run. |
Trott
commented
Jan 27, 2020
Although if there was an impressive-benchmarks-mean-you-can-land-without-a-clean-CI rule, this would definitely qualify. 😍 |
PR-URL: #31489 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #31489 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #31489 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Uses the native
typedArray.fill()when filling with a number instead of calling into the binding fill function.Benchmark results:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes