Skip to content

Returning a Buffer without memory copy #1171

Discussion options

You must be logged in to vote

For anyone else who encounters this and is interested:

It turned out most of the slowdown I was experiencing was actually due to the JS benchmarking framework I used, which it turns out runs the entire benchmark synchronously with no breaks (ticks) between runs. This meant V8 had no opportunity to garbage collect, so buffers returned to JS ate up more and more memory as the benchmark progressed, whereas buffers that stayed on Rust side got freed promptly. It was the memory pressure which slowed down JS, more than the cost of conversion to a buffer, and once I inserted some ticks to allow buffers to be freed on JS side, the performance gap I was asking about above narrowed dramatically.

Th…

Replies: 2 comments 2 replies

Comment options

Brooooooklyn
May 9, 2022
Maintainer Sponsor

You must be logged in to vote
2 replies
@overlookmotel
Comment options

@overlookmotel
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by overlookmotel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants