Run the benchmark:
$ npm i benchmark
# Run the AsyncLocalStorage benchmark
$ node async-local-storage.js ASL
ASL x 15,551 ops/sec ±3.30% (79 runs sampled)
# https://stackoverflow.com/questions/60910274/int32-vs-float64-performances-in-crystal | |
require "benchmark" | |
def percentage_diff(number_a, number_b) | |
small_number = (number_a > number_b) ? number_b : number_a | |
big_number = (number_a < number_b) ? number_b : number_a | |
(big_number - small_number) / small_number | |
end |
node bench/returning-promises.js | |
standard x 3,096,388 ops/sec ±0.77% (91 runs sampled) | |
async wrapped x 1,853,672 ops/sec ±1.12% (81 runs sampled) | |
await then return x 1,074,238 ops/sec ±1.96% (53 runs sampled) | |
Fastest is standard |
const | |
PipeRunner = require('./pipeRunner'); | |
const now = (unit) => { | |
const hrTime = process.hrtime(); | |
switch (unit) { | |
case 'milli': |
const | |
PipeRunner = require('./pipeRunner'); | |
const now = (unit) => { | |
const hrTime = process.hrtime(); | |
switch (unit) { | |
case 'milli': |
const Benchmark = require('benchmark') | |
const _ = require('lodash'); | |
const suite = new Benchmark.Suite | |
const obj1 = { | |
nested: { | |
object: { | |
value: 'string' | |
} |
const Benchmark = require('benchmark') | |
const suite = new Benchmark.Suite | |
const array = []; | |
for (let i = 0; i < 1000; i++) { | |
array.push({ value: i }); | |
} |
const Benchmark = require('benchmark') | |
const _ = require('lodash'); | |
const suite = new Benchmark.Suite | |
const obj = { | |
value: 42, | |
name: 'jean', | |
not: 'taked' | |
}; |
const Benchmark = require('benchmark') | |
const suite = new Benchmark.Suite | |
const array = []; | |
for (let i = 0; i < 1000; i++) { | |
array.push({ value: i }); | |
} |