Conversation
src/node_internals.h
Outdated
There was a problem hiding this comment.
Would it be possible to explicitly note that a HandleScope must have been opened before calling this function?
There was a problem hiding this comment.
@TimothyGu I think that’s kind of explicit in the fact that this returns a MaybeLocal; that’s never valid without a HandleScope, right?
(Or, the other way around: The same is true of the other buffer constructors, but we don’t mention it there.)
There was a problem hiding this comment.
That's certainly true. But the other Buffer constructors open a HandleScope themselves so I was wondering.
There was a problem hiding this comment.
@TimothyGu I removed it in this case because, as far as I can tell, all the temporary handles created here refer to objects that are kept alive be the returned Buffer instance anyway.
If my understanding is correct, I think they could be removed in the other cases as well, but I am not 100 % sure and since some of them are public API I left them the way they were.
test/common/index.js
Outdated
There was a problem hiding this comment.
Should the returned function return a promise as well, so that one could chain the functions returned by mustCallAsync?
lib/perf_hooks.js
Outdated
There was a problem hiding this comment.
I would prefer we didn't define these here, but rather in the HTTP2 part. I think these are also defined for every single instance, which will increase overhead.
jasnell
left a comment
There was a problem hiding this comment.
Nice. Did you benchmark this at all? It should yield a nice modest boost.
Add a C++ variant of `Buffer.from(arrayBuffer, offset, length)`.
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS.
a2c195f to
d6fcbed
Compare
|
This is no longer blocked by #18020. CI: https://ci.nodejs.org/job/node-test-commit/15373/ |
|
@nodejs/benchmarking https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/93/console says
Is there anything we can do about that? |
|
Ping @nodejs/build |
Add a C++ variant of `Buffer.from(arrayBuffer, offset, length)`. PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS. PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Add a C++ variant of `Buffer.from(arrayBuffer, offset, length)`. PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS. PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Add a C++ variant of `Buffer.from(arrayBuffer, offset, length)`. PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS. PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to |
Add a C++ variant of `Buffer.from(arrayBuffer, offset, length)`. PR-URL: nodejs#18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS. PR-URL: nodejs#18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS. Backport-PR-URL: #20456 PR-URL: #18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Add a C++ variant of `Buffer.from(arrayBuffer, offset, length)`. PR-URL: nodejs#18030 Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor the read mechanism to completely avoid copying. Instead of copying individual `DATA` frame contents into buffers, create `ArrayBuffer` instances for all socket reads and emit slices of those `ArrayBuffer`s to JS. PR-URL: nodejs#18030 Reviewed-By: James M Snell <jasnell@gmail.com>
The first commit is from #18020 to avoid merge conflicts.src: introduce internal buffer slice constructor
Add a C++ variant of
Buffer.from(arrayBuffer, offset, length).http2: refactor read mechanism
Refactor the read mechanism to completely avoid copying.
Instead of copying individual
DATAframe contents into buffers,create
ArrayBufferinstances for all socket reads and emitslices of those
ArrayBuffers to JS.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
/cc @nodejs/http2