From 47fdbca8b1c3999c5726f54531f8b47640a65a6f Mon Sep 17 00:00:00 2001 From: jongleberry Date: Tue, 17 Aug 2021 20:54:32 -0700 Subject: [PATCH] delete benchmarks --- .travis.yml | 5 ----- benchmarks/Makefile | 23 ----------------------- benchmarks/middleware.js | 30 ------------------------------ benchmarks/run | 16 ---------------- 4 files changed, 74 deletions(-) delete mode 100644 benchmarks/Makefile delete mode 100644 benchmarks/middleware.js delete mode 100755 benchmarks/run diff --git a/.travis.yml b/.travis.yml index 1438faf1e..9caf88b8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,7 @@ node_js: - 14 cache: directories: - - wrk/bin - node_modules -before_script: - - npm prune - - "[ ! -f wrk/bin/wrk ] && rm -rf wrk && git clone https://github.com/wg/wrk.git && make -C wrk && mkdir wrk/bin && mv wrk/wrk wrk/bin || true" - - export PATH=$PATH:$PWD/wrk/bin/ script: - npm run lint - npm run test-cov diff --git a/benchmarks/Makefile b/benchmarks/Makefile deleted file mode 100644 index 165cab4d7..000000000 --- a/benchmarks/Makefile +++ /dev/null @@ -1,23 +0,0 @@ - -all: middleware - -middleware: - @./run 1 false $@ - @./run 5 false $@ - @./run 10 false $@ - @./run 15 false $@ - @./run 20 false $@ - @./run 30 false $@ - @./run 50 false $@ - @./run 100 false $@ - @./run 1 true $@ - @./run 5 true $@ - @./run 10 true $@ - @./run 15 true $@ - @./run 20 true $@ - @./run 30 true $@ - @./run 50 true $@ - @./run 100 true $@ - @echo - -.PHONY: all middleware diff --git a/benchmarks/middleware.js b/benchmarks/middleware.js deleted file mode 100644 index c9c7dcbb4..000000000 --- a/benchmarks/middleware.js +++ /dev/null @@ -1,30 +0,0 @@ - -'use strict'; - -const Koa = require('..'); -const app = new Koa(); - -// number of middleware - -let n = parseInt(process.env.MW || '1', 10); -const useAsync = process.env.USE_ASYNC === 'true'; - -console.log(` ${n}${useAsync ? ' async' : ''} middleware`); - -while (n--) { - if (useAsync) { - app.use(async(ctx, next) => next()); - } else { - app.use((ctx, next) => next()); - } -} - -const body = Buffer.from('Hello World'); - -if (useAsync) { - app.use(async(ctx, next) => { await next(); ctx.body = body; }); -} else { - app.use((ctx, next) => next().then(() => ctx.body = body)); -} - -app.listen(3333); diff --git a/benchmarks/run b/benchmarks/run deleted file mode 100755 index b716fa557..000000000 --- a/benchmarks/run +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -echo -MW=$1 USE_ASYNC=$2 node $3 & -pid=$! - -sleep 2 - -wrk 'http://localhost:3333/?foo[bar]=baz' \ - -d 3 \ - -c 50 \ - -t 8 \ - | grep 'Requests/sec' \ - | awk '{ print " " $2 }' - -kill $pid