Unverified Commit cb2535ef authored by Yash Ladha's avatar Yash Ladha Committed by James M Snell
Browse files

os: performance improvement in vector allocation

We were using the result vector with an object which is not a primitive
data type, and going with the constructor allocation pattern it creates
a size of that vector and also initializes the spaces with the data type
as well which is in our case is `Local<Value>`. It leads to waste of
some CPU cycles and instead we just wanted to have some reserved space
in our vector.

We can use `reserve` method on vector to reserve some space for the
vector but doesn't initialize the value since we are anyways doing it in
the following loop.

PR-URL: https://github.com/nodejs/node/pull/36748


Reviewed-By: default avatarRobert Nagy <ronagy@icloud.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent 341bbd38
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment