Skip to content

Commit e7acfbf

Browse files
committed
feat: add @fastify/vue, @fastify/react, Nuxt and Next benchmarks
1 parent bd7a8a6 commit e7acfbf

31 files changed

Lines changed: 11683 additions & 0 deletions

fastify-react/client/index.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<style>
7+
body {
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
height: 100vh;
12+
background-color: #f0f0f0;
13+
margin: 0;
14+
}
15+
#wrapper {
16+
width: 960px;
17+
height: 720px;
18+
position: relative;
19+
background-color: white;
20+
}
21+
.tile {
22+
position: absolute;
23+
width: 10px;
24+
height: 10px;
25+
background-color: #333;
26+
}
27+
</style>
28+
<!-- head -->
29+
</head>
30+
<body>
31+
<!-- hydration -->
32+
<div id="root"><!-- element --></div>
33+
<script type="module" src="/$app/mount.js"></script>
34+
</body>
35+
</html>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
export default function Home () {
3+
const wrapperWidth = 960
4+
const wrapperHeight = 720
5+
const cellSize = 10
6+
const centerX = wrapperWidth / 2
7+
const centerY = wrapperHeight / 2
8+
9+
let angle = 0
10+
let radius = 0
11+
12+
const tiles = []
13+
const step = cellSize
14+
15+
let x
16+
let y
17+
while (radius < Math.min(wrapperWidth, wrapperHeight) / 2) {
18+
x = centerX + Math.cos(angle) * radius
19+
y = centerY + Math.sin(angle) * radius
20+
21+
if (x >= 0 && x <= wrapperWidth - cellSize && y >= 0 && y <= wrapperHeight - cellSize) {
22+
x = x.toFixed(2)
23+
y = y.toFixed(2)
24+
tiles.push({ x, y, id: `${x}:${y}` })
25+
}
26+
27+
angle += 0.2
28+
radius += step * 0.015
29+
}
30+
31+
return (
32+
<div id="wrapper">
33+
{tiles.map(({ x, y, id }) => (
34+
<div
35+
key={id}
36+
className="tile"
37+
style={{
38+
left: `${x}px`,
39+
top: `${y}px`
40+
}} />
41+
))}
42+
</div>
43+
);
44+
}

fastify-react/package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "module",
3+
"scripts": {
4+
"dev": "NODE_ENV=production node server.js --dev",
5+
"build": "NODE_ENV=production vite build",
6+
"start": "NODE_ENV=production node server.js"
7+
},
8+
"dependencies": {
9+
"@fastify/react": "^1.0.0",
10+
"@fastify/vite": "^8.0.2",
11+
"fastify": "^5.2.2",
12+
"history": "^5.3.0",
13+
"react": "^19.1.0",
14+
"react-dom": "^19.1.0",
15+
"react-router": "^7.5.0",
16+
"react-router-dom": "^7.5.0",
17+
"unihead": "^0.8.0",
18+
"valtio": "^2.1.4"
19+
},
20+
"devDependencies": {
21+
"@vitejs/plugin-react": "^4.3.4",
22+
"vite": "^6.2.5"
23+
}
24+
}

0 commit comments

Comments
 (0)