Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
_.flow vs flew
(version: 0)
Compare lodash flow with custom method
Comparing performance of:
flow vs flew
Created:
7 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const flow = (funcs) => { const length = funcs ? funcs.length : 0 let index = length while (index--) { if (typeof funcs[index] != 'function') { throw new TypeError('Expected a function') } } return function (...args) { let index = 0 let result = length ? funcs[index].apply(this, args) : args[0] while (++index < length) { result = funcs[index].call(this, result) } return result } } const flew = (funcs) => { if(funcs.some(func => typeof func != 'function')) { throw new TypeError('Expected a function') } return (...args) => funcs.reduce((arg, fn, i) => i == 0 ? fn(...arg) : fn(arg), args) } const add = (i, j) => i + j const mult = (_, i, j) => _ * i const funcs = [add, mult.bind(this, 3)] function doFlow() { return flow(funcs)(1,2) } function doFlew() { return flew(funcs)(1,2) }
Tests:
flow
var flowResult = 0; flowResult = doFlow();
flew
var flewResult = 0; flewResult = doFlew();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
flow
flew
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Lodash filter
lodash / native filter with includes
lodash / native filter with _includes
Lodash filter 1 000 000
lodash vs es6 map
Comments
Confirm delete:
Do you really want to delete benchmark?