add: Add benchmarks

This commit is contained in:
Sébastien Chopin 2017-10-28 14:09:05 +02:00
parent 954a6c7534
commit 3d98a8be7f
4 changed files with 46 additions and 0 deletions

29
benchmarks/README.md Normal file
View File

@ -0,0 +1,29 @@
# Nuxt.js server-side benchmarks
> Taken from [Next.js benchmarks](https://github.com/zeit/next.js/tree/master/bench), if you like React, we recommend you to try [Next.js](https://github.com/zeit/next.js).
## Installation
Follow the steps in [CONTRIBUTING.md](../CONTRIBUTING.md).
Both benchmarks use `ab`. So make sure you have it installed.
## Usage
Before running the test:
```
npm run start
```
Then run one of these tests:
- Stateless application which renders `<h1>My component!</h1>`. Runs 3000 http requests.
```
npm run bench:stateless
```
- Stateless application which renders `<li>This is row {i}</li>` 10.000 times. Runs 500 http requests.
```
npm run bench:stateless-big
```

9
benchmarks/package.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "nuxt-benchmarks",
"scripts": {
"build": "nuxt build",
"start": "npm run build && nuxt start",
"bench:stateless": "ab -c1 -n3000 http://127.0.0.1:3000/stateless",
"bench:stateless-big": "ab -c1 -n500 http://127.0.0.1:3000/stateless-big"
}
}

View File

@ -0,0 +1,5 @@
<template>
<ul>
<li v-for="n in 10000" :key="n">This is row {{ n + 1 }}</li>
</ul>
</template>

View File

@ -0,0 +1,3 @@
<template>
<h1>My component!</h1>
</template>