Closed gavinaiken closed 6 years ago
Ok, I was wondering if this is going to make it faster
Delian
On Wed, Jun 27, 2018 at 11:47 AM Gavin Aiken notifications@github.com wrote:
This is an optimization from my colleague Tom, would be great to also get this merged, thanks!
Using the object literal syntax var o = {} and then immediately setting various properties on it such as o['src_addr'] = ..., can cause prototype transitions to occur frequently. As a result, it may be easier on memory to simply use a map instead by using Object.create(null)
You can view, comment on, or merge this pull request online at:
https://github.com/delian/node-netflowv9/pull/19 Commit Summary
- Use Object.create(null) in place of o = {} to reduce IC_Miss
File Changes
- M js/nf9/nf9decode.js https://github.com/delian/node-netflowv9/pull/19/files#diff-0 (2)
Patch Links:
- https://github.com/delian/node-netflowv9/pull/19.patch
- https://github.com/delian/node-netflowv9/pull/19.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/delian/node-netflowv9/pull/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG7ZrbDpmEipXxuTNM3uHZRLS6Hf5fkks5uA1SlgaJpZM4U5ZI6 .
Should be merged, and version 0.2.14 is published in npm
I think it made a small difference in our testing, not dramatic, but worth doing
This is an optimization from my colleague Tom, would be great to also get this merged, thanks!
Using the object literal syntax
var o = {}
and then immediately setting various properties on it such aso['src_addr'] = ...
, can cause prototype transitions to occur frequently. As a result, it may be easier on memory to simply use a map instead by usingObject.create(null)