Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active April 27, 2016 15:06
Show Gist options
  • Save springmeyer/7900319 to your computer and use it in GitHub Desktop.
Save springmeyer/7900319 to your computer and use it in GitHub Desktop.
Node.js C++ addon performance tips

Don't use String::NewSymbol

String::NewSymbol is recommended by v8 docs for wrapping string data that represent commonly used keys. The reason is for lookups to be faster (https://bugs.webkit.org/show_bug.cgi?id=104082#c0). But in testing this is actually usually a deoptimization because creating new symbols is slower than strings. This is confirmed by this Node.js core commit Remove v8::String::NewSymbol() entirely: https://github.com/joyent/node/commit/f674b09f40d22915e15b6968aafc5d25ac8178a2. More details: https://bugs.webkit.org/show_bug.cgi?id=94574#c10

Typed Arrays

can be done in node.js like nodejs/node-v0.x-archive#4201 (comment)

other resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment