EXPERIMENTAL: feat(ops): String fast ops, fast op_base64_decode #16014
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces
String
support to fast ops, and trials a method of makingZeroCopyBuf
-returning ops fast-compliant by having them return a ResourceId and (through an out-buffer) a buffer size. JS side will then create a buffer of that size and call a finisher op that writes the Vec to the passed-in buffer and drops the Vec.The fast-compliant
ZeroCopyBuf
returning functions are a pretty easy idea and shouldn't really cause any issues. The experimental nature of this PR is in theString
support for fast ops.First of all, the support required adding a
v8::Isolate
pointer to theOpState
which is already really dirty. Additionally, while @littledivy has verified that it is possible to get the string content, it may not work in all cases. @AaronO raised the possibility that getting the string content for string ropes might cause V8 to do string combining, meaning that suddenly the fast op would be proccing heap allocations and that might cause V8 to panic.Locally tests pass so nothing is breaking directly, but tests likely never use roped strings so this is no guarantee. Additionally,
op_base64_decode
is apparently not used at all, anywhere.