14. ab output
Concurrency Level: 100
Time taken for tests: 8.680 seconds
Requests per second: 11521.27 [#/sec] (mean)
Time per request: 8.680 [ms] (mean)
Time per request: 0.087 [ms] (mean,
across all concurrent requests)
16. var maxRuns = 1000;
var start = Date.now();
for (var i = 0; i < maxRuns; i++) {
// do stuff...
}
var end = Date.now();
var elapsed = end – start;
var timePerRun = elapsed / maxRuns;
console.log(elapsed + ‘ ms’);
console.log(timePerRun + ‘ ms/run’
23. Try-Catch
try {
process();
} catch(e) {
console.log(e);
}
function process() {
// hot code
}
24. Hot Code
• Don’t monkey-patch.
• Don’t mix types for the same property.
• Avoid dictionary mode.
• Set all properties in the constructor.
• Move high-performance code out of try-catch.
• If array.length < 65000, specify the size.
35. [JavaScript]:
ticks total nonlib name
251 0.5% 0.5% LazyCompile:
*Socket.write net.js:465
[C++]:
ticks total nonlib name
48625 94.4% 94.4% ___psynch_rw_unlock
[GC]:
ticks total nonlib name
263 0.5%