Commit 36e8a2c6 authored by Trevor Norris's avatar Trevor Norris
Browse files

node: improve performance of hrtime()

process.hrtime() was performing too many operations in C++ that could be
done faster in JS. Move those operations over by creating a length 4
Uint32Array and perform bitwise operations on the seconds so that it was
unnecessary for the native API to do any object creation or set any
fields.

This has improved performance from ~350 ns/op to ~65 ns/op. Light
benchmark included to demonstrate the performance change.

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


Reviewed-By: default avatarFedor Indutny <fedor@indutny.com>
parent 946315f7
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