This benchmark compares the following libraries:
- metrics@0.1.20 + mikejihbe/metrics#67
- measured-core@1.40.1
- hdr-histogram-js@1.1.4
- native-hdr-histogram@0.5.0
of:
const http = require("http"); | |
const net = require("net"); | |
const server = http.createServer((req, res) => { | |
req.resume(); | |
res.end("hello"); | |
}); | |
server.keepAliveTimeout = 6 * 1000; | |
server.headersTimeout = 4 * 1000; |
const http = require('http'); | |
const server = http.createServer((req, res) => { | |
console.log('[server] request'); | |
setTimeout(() => { | |
res.end('hello'); | |
console.log('[server] response'); | |
}, 3000); | |
}); | |
server.listen(3000, () => { |
This benchmark compares the following libraries:
of:
const a = { | |
a: 1, | |
b: null | |
}; | |
const b = { | |
a: 2, | |
b: null | |
}; | |
const c = { | |
a: 2, |
function countChildren(el) { | |
const children = el && el.children; | |
if (!children) { | |
return 0; | |
} | |
let count = 0; | |
for (let i = 0; i < children.length; i++) { | |
const child = children[i]; | |
count += 1; | |
count += countChildren(child); |
const fs = require('fs'); | |
const path = require('path'); | |
class Node { | |
constructor(start, end, depth) { | |
this.start = start; | |
this.end = end; | |
this.middle = Math.floor((start + end) / 2); | |
this.items = []; | |
this.left = null; |
I have been generating CPU Flame Graphs of Node.js applications with Linux perf
command, and noticed that some of the graphs have suspicious labels. For example, with a sandbox project and Node 10.8.0, I got LazyCompile:*a.renderDOM /opt/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:35
where it should have been something related to streams.
For example, the following is a stack trace from perf script
that I used to genearte a CPU Flame Graph. 227bbdff955b
has a label LazyCompile:*a.renderDOM
, but it doesn't make much sense that React.renderDOM
was called from _stream_readable.js
and parsed JSON in it.
node 22640 56531.256247: 10101010 cpu-clock:
.PHONY: build | |
configure: | |
@node-gyp configure | |
build: | |
@node-gyp build | |
run: | |
@node index.js |
UV_THREADPOOL=100 node index.js
ab -c 100 -n 1000
htop