This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('Register an hook after a plugin', t => { | |
t.plan(6) | |
const fastify = Fastify() | |
fastify.register(fp(function (instance, opts, next) { | |
instance.addHook('preHandler', function (req, reply, next) { | |
t.ok('called') | |
next() | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -x | |
set -e | |
curl -L https://github.com/nodejs/node/pull/$1.patch | git am --whitespace=fix | |
get-metadata $1 -f msg.txt | |
echo -e "$(git show -s --format=%B)\n\n$(cat msg.txt)" > msg.txt | |
git commit --amend -F msg.txt | |
git show -s --format=%B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var querystring = require('querystring') | |
function createManyParams (count) { | |
var str = '' | |
if (count === 0) { | |
return str | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./deps/v8/tools/mac-tick-processor isolate-0x102801600-v8.log | |
Statistical profiling result from isolate-0x102801600-v8.log, (5977 ticks, 162 unaccounted, 0 excluded). | |
[Shared libraries]: | |
ticks total nonlib name | |
3 0.1% /usr/lib/system/libsystem_pthread.dylib | |
1 0.0% /usr/lib/system/libdyld.dylib | |
[JavaScript]: | |
ticks total nonlib name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var max = 100000000 | |
console.time('empty loop') | |
function loop () { | |
for (var i = 0; i < max; i++) {} | |
} | |
loop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var benchmark = require('benchmark') | |
var suite = new benchmark.Suite() | |
var runs = 0 | |
class MyClass { | |
constructor (x) { | |
this.x = x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var benchmark = require('benchmark') | |
var suite = new benchmark.Suite() | |
var runs = 0 | |
class MyClass { | |
constructor (x) { | |
this.x = x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var benchmark = require('benchmark') | |
var suite = new benchmark.Suite() | |
var runs = 0 | |
class MyClass { | |
constructor (x) { | |
this.x = x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var MAX = 1000000000 | |
var factory = { | |
create() { | |
throw new Error('kaboom') | |
return { | |
something() { | |
return 'hello world' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var bench = require('fastbench') | |
var bunyan = require('bunyan') | |
var pinoms = require('./index') | |
var fs = require('fs') | |
var dest = fs.createWriteStream('/dev/null') | |
var pino = require('pino') | |
var tenStreams = [ |