UNPKG

1.69 kBMarkdownView Raw
1<h1 align="center">Fastify</h1>
2
3## Benchmarking
4Benchmarking is important if you want to measure how a change can impact the performance of your application. We provide a simple way to benchmark your application from the point of view of a user and contributor. The setup allows you to automate benchmarks in different branches and on different Node.js versions.
5
6The modules we'll use:
7- [Autocannon](https://github.com/mcollina/autocannon): A HTTP/1.1 benchmarking tool written in node.
8- [Branch-comparer](https://github.com/StarpTech/branch-comparer): Checkout multiple git branches, execute scripts and log the results.
9- [Concurrently](https://github.com/kimmobrunfeldt/concurrently): Run commands concurrently.
10- [Npx](https://github.com/zkat/npx) NPM package runner - We are using it to run scripts against different Node.js Versions and to execute local binaries. Shipped with npm@5.2.0.
11
12## Simple
13
14### Run the test in the current branch
15```sh
16npm run benchmark
17```
18
19### Run the test against different Node.js versions ✨
20```sh
21npx -p node@6 -- npm run benchmark
22```
23
24## Advanced
25
26### Run the test in different branches
27```sh
28branchcmp --rounds 2 --script "npm run benchmark"
29```
30
31### Run the test in different branches against different Node.js versions ✨
32```sh
33branchcmp --rounds 2 --script "npm run benchmark"
34```
35
36### Compare current branch with master (Gitflow)
37```sh
38branchcmp --rounds 2 --gitflow --script "npm run benchmark"
39```
40or
41```sh
42npm run bench
43```
44
45### Run different examples
46
47```sh
48branchcmp --rounds 2 -s "node ./node_modules/concurrently -k -s first \"node ./examples/asyncawait.js\" \"node ./node_modules/autocannon -c 100 -d 5 -p 10 localhost:3000/\""
49```