/
erioxis
/
web-nodejs
Обзор
Документация
Войти
/
erioxis
/
web-nodejs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/node_modules/fastfall/bench.js
81 строка
1 KB
erioxis
lab11fix
15 дек 2025, 23:21
15 дек 2025, 23:21
70dc7ba
Код
Авторство
О чём код?
'use strict' var max = 100000 var async = require('async') var insync = require('insync') var neoAsync = require('neo-async') var fall = require('./')() var runWaterfall = require('run-waterfall') var waterfallize = require('waterfallize') var bench = require('fastbench') var nextDone var nextCount function benchSetImmediate (done) { nextCount = 3 nextDone = done setImmediate(somethingImmediate) } function somethingImmediate () { nextCount-- if (nextCount === 0) { nextDone() } else { setImmediate(somethingImmediate) } } function somethingB (cb) { setImmediate(cb) } function somethingA (cb) { setImmediate(cb) } var toCall = [somethingA, somethingB, somethingB] function benchAsyncWaterfall (done) { async.waterfall(toCall, done) } function benchFastFall (done) { fall(toCall, done) } function benchWaterfallize (done) { var next = waterfallize() next(toCall[0]) next(toCall[1]) next(toCall[2]) next(done) } function benchRunWaterFall (done) { runWaterfall(toCall, done) } function benchInsync (done) { insync.waterfall(toCall, done) } function benchNeoAsync (done) { neoAsync.waterfall(toCall, done) } var compiled = require('./')(toCall) var run = bench([ benchAsyncWaterfall, benchInsync, benchNeoAsync, benchRunWaterFall, benchSetImmediate, benchWaterfallize, benchFastFall, compiled ], max) run(run)