Don't allocate if the caller to fast args does not obtain an object #685
+3
−26
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.
Currently, when there are any objects in the argument list, V8FastArgs allocates managed heap memory even if they are never accessed. Also, any additional API to access V8 objects in a non-allocating way depends on this change.
I argue that preemptively allocating objects and caching them in an array only makes sense if you expect the caller to call V8FastArgs.Get on the same argument many times. But that case does not exist. A caller who uses FastProxy cares about performance and can be expected to call V8FastArgs.Get only once and store the result in a local variable for reuse.
My goal is to have zero unsolicited allocations when responding to calls from JavaScript through V8FastArgs. If this pull request is not to your liking, tell me what you would accept, and I'll try to make that.