`Buffer.write(Array<string|Buffer>, offset: number, encoding: string)`
Open
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 399
- Forks
- 11
- Avg merge
- 29m
- Merged PRs (30d)
- 1
Description
Implement as smarter Buffer.write to avoid a lot of overhead. Consider the following example:
poolOffset += poolBuffer.asciiWrite(`{"seq":`, poolOffset)
poolOffset += poolBuffer.asciiWrite(seq, poolOffset)
poolOffset += poolBuffer.asciiWrite(`,"id":"`, poolOffset)
poolOffset += key.copy(poolBuffer, poolOffset)
poolOffset += poolBuffer.asciiWrite(`","changes":[{"rev":"`, poolOffset)
poolOffset += version.copy(poolBuffer, poolOffset)
poolOffset += poolBuffer.asciiWrite(`"}]`, poolOffset)
Could be reduced to:
poolOffset += poolBuffer.write([
`{"seq":`,
seq,
`,"id":"`,
key,
`","changes":[{"rev":"`,
version,
`"}]`
], poolOffset, 'ascii')
and avoid a lot of js -> cpp calls
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 with the existing Buffer.write entry point and the mixed string, Array, and Buffer signature described in the issue. Done means the shown call works with the offset and encoding while avoiding the repeated JavaScript-to-C++ calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100