We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer.write(Array<string|Buffer>, offset: number, encoding: string)
Implement as smarter Buffer.write to avoid a lot of overhead. Consider the following example:
Buffer.write
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
The text was updated successfully, but these errors were encountered:
It might be useful to elaborate. Why does this require new functionality in Buffer? Can't this be improved already?
(I am not being argumentative, this is a genuine question.)
Sorry, something went wrong.
How would you improve it? I think part of the problem is the number of times a js/c++ boundary needs to be crossed.
Maybe use fastcall for asciiWrite?
Buffer.asciiWrite
Buffer.set
No branches or pull requests
Implement as smarter
Buffer.write
to avoid a lot of overhead. Consider the following example:Could be reduced to:
and avoid a lot of js -> cpp calls
The text was updated successfully, but these errors were encountered: