-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
c++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
On last CTC/V8 meeting I think @trevnorris mentioned something to the effect of
Turning
Local<Array>into a list ofLocal<Value>is slow. Possibly due to crossing the API boundary repeatedly. This is often done to extract function arguments from an array before calling the function. Exposing spread call to API would help a lot.
Could I solicit some examples in Node.js source? I'd like to understand the use case here to come up with the best solution. Two that I have in mind:
std::vector<Local<Value>> v8::Array::ToList(Local<Array>, int limit). This is more general purpose. We would be able to reduce the overhead of repeatedly crossing the API boundary and use V8's internal mechanisms to iterate an Array faster. It's debatable what to do with holes (prototype chain lookup?) and getters though.v8::Function::SpreadCall(Local<Value> receiver, Local<Array> spread_args). From what I remember from the discussion, this is the primary use of turning an array into a list in the first place. V8 has optimizations in place to make spread calls very fast, so if the use case matches, I'd prefer this over the general purpose solution.
addaleax
Metadata
Metadata
Assignees
Labels
c++Issues and PRs that require attention from people who are familiar with C++.Issues and PRs that require attention from people who are familiar with C++.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.