mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
add: Add benchmarks
This commit is contained in:
parent
954a6c7534
commit
3d98a8be7f
29
benchmarks/README.md
Normal file
29
benchmarks/README.md
Normal 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
9
benchmarks/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
5
benchmarks/pages/stateless-big.vue
Normal file
5
benchmarks/pages/stateless-big.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<ul>
|
||||||
|
<li v-for="n in 10000" :key="n">This is row {{ n + 1 }}</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
3
benchmarks/pages/stateless.vue
Normal file
3
benchmarks/pages/stateless.vue
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<h1>My component!</h1>
|
||||||
|
</template>
|
Loading…
Reference in New Issue
Block a user