Skip to content

Instantly share code, notes, and snippets.

View trevnorris's full-sized avatar

Trevor Norris trevnorris

View GitHub Profile
@jkrems
jkrems / es-module-history.md
Last active August 19, 2024 02:13
History of ES modules

Modules - History & Future

History

Introduction

This is a short write-up that explains why test/addons/make-callback-recurse/test.js in github.com/nodejs/node/pull/4507 fails with the following error message:

$ node test.js
d2 error
/Users/JulienGilli/dev/node/node/test/addons/make-callback-recurse/test.js:88
 throw new Error('test d1');
@ofrobots
ofrobots / gist:0bdcab89771221ace68d
Last active May 24, 2019 08:53
Using V8's gdb macros for low level debugging
$ gdb --args ./iojs_g -pe 'process.hrtime([0,0])'
(gdb) source deps/v8/tools/gdbinit
(gdb) b node::Hrtime
Breakpoint 1 at 0x1282619: file ../src/node.cc, line 2028.
(gdb) r
Starting program: /usr/local/google/home/ofrobots/src/io.js/iojs_g -pe process.hrtime\(\[0,0\]\)
...
Breakpoint 1, node::Hrtime (args=...) at ../src/node.cc:2028
@trevnorris
trevnorris / .eslintrc
Last active August 29, 2015 14:18
My .eslintrc of choice. Still have a few things to work out.
{
'ecmaFeatures': {
'binaryLiterals': true,
'blockBindings': true,
'forOf': true,
'generators': true,
'octalLiterals': true,
'templateStrings': true,
},
'env': {
@domenic
domenic / v8-versions.md
Last active December 11, 2020 01:45
V8 versions for embedders

Embedders of V8 should generally use the head of the branch corresponding to the minor version of V8 that ships in Chrome.

Finding the minor version of V8 corresponding to the latest stable Chrome

To find out what version this is,

  1. Go to https://omahaproxy.appspot.com/
  2. Find the latest stable Chrome version in the table
  3. Enter it into the "Translate a Chrome verison to a V8 version" box below the table.
  4. Ignore the last two parts.

Notes:

  • Text in [[ ]] are the internal libuv function call.
  • Text in {{ }} are the Node functions that are affected.
  • Text in ( ) are notes about what is happening.
  • While the Windows event loop has minor variations, I don't believe any of those affect Node.

On process.nextTick():

@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active December 24, 2023 05:25
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@max-mapper
max-mapper / readme.md
Last active August 8, 2016 18:45
simple 4mb buffer proxy benchmarks

simple 4mb buffer proxy benchmarks

the goal: to do fast virtual host routing, e.g. to have a single process on a machine listening on port 80 and proxying data based on HTTP Host to other non-port-80 web processes on the same machine

many people use nginx for this because nginx is faster than node is currently for data-heavy applications (see below)

about these benchmarks

they use the JS proxies from https://github.com/substack/bouncy/tree/master/bench

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: