Skip to content

Instantly share code, notes, and snippets.

View jesseduffield's full-sized avatar

Jesse Duffield jesseduffield

View GitHub Profile
@jesseduffield
jesseduffield / benchmark.js
Created July 11, 2020 09:05
Benchmarking array functions
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite();
const testMap = (array, transform) => {
return array.map(item => transform(item));
};
const testReduce = (array, transform) => {
return array.reduce((acc, item) => acc.concat(transform(item)), []);