Optimize passing protobuf message back from threadpool
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 248
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
The `AfterRange` function currently calls `Nan::CopyBuffer` which creates a copy of the entire protobuf string before passing the back to JS.
We can optimize this by using the signature of `Nan::NewBuffer` that will take ownership of the string rather than copying it, to allow zero-copy passing of data from C++ to JS.
This method can be described at https://github.com/mapbox/node-cpp-skel/issues/69
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the AfterRange function and review its current Nan::CopyBuffer call, then read the linked node-cpp-skel issue for the ownership-based Nan::NewBuffer approach. Done means protobuf data is passed from the threadpool to JavaScript without copying the entire string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, node.js
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100