Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
88d412a7
Commit
88d412a7
authored
Feb 12, 2026
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use tinybench
parent
cd0496f9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
36 deletions
+100
-36
bench.mjs
bench/table-1000-items-client-component/bench.mjs
+49
-18
package.json
bench/table-1000-items-client-component/package.json
+1
-0
bench.mjs
bench/table-1000-items-server-component/bench.mjs
+49
-18
package.json
bench/table-1000-items-server-component/package.json
+1
-0
No files found.
bench/table-1000-items-client-component/bench.mjs
View file @
88d412a7
...
...
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'url'
import
{
promises
as
fs
}
from
'fs'
import
prettyMs
from
'pretty-ms'
import
treeKill
from
'tree-kill'
import
{
Bench
}
from
'tinybench'
const
__dirname
=
dirname
(
fileURLToPath
(
import
.
meta
.
url
))
const
ROOT_DIR
=
join
(
__dirname
,
'..'
,
'..'
)
...
...
@@ -126,26 +127,56 @@ async function main() {
const
instance
=
await
startServer
()
try
{
// Warmup phase: send requests continuously for WARMUP_DURATION_MS
console
.
log
(
`\nWarming up for
${
prettyMs
(
WARMUP_DURATION_MS
)}
...`
)
let
warmupCount
=
0
const
warmupEnd
=
performance
.
now
()
+
WARMUP_DURATION_MS
while
(
performance
.
now
()
<
warmupEnd
)
{
await
measureRequest
(
URL
)
warmupCount
++
}
console
.
log
(
`Warmup complete (
${
warmupCount
}
requests)`
)
// Benchmark requests
console
.
log
(
`\nRunning
${
BENCH_REQUESTS
}
benchmark requests...\n`
)
const
durations
=
[]
// Benchmark requests using tinybench built-in warmup.
console
.
log
(
`\nPreparing tinybench benchmark...`
)
const
bench
=
new
Bench
({
name
:
'table-1000-items-client-component'
,
time
:
0
,
iterations
:
BENCH_REQUESTS
,
warmup
:
true
,
warmupTime
:
WARMUP_DURATION_MS
,
retainSamples
:
true
,
throws
:
true
,
})
for
(
let
i
=
0
;
i
<
BENCH_REQUESTS
;
i
++
)
{
const
duration
=
await
measureRequest
(
URL
)
durations
.
push
(
duration
)
}
bench
.
add
(
'request'
,
async
()
=>
{
await
measureRequest
(
URL
)
},
{
async
:
true
,
}
)
const
stats
=
statistics
(
durations
)
console
.
log
(
`\nRunning
${
BENCH_REQUESTS
}
benchmark requests with tinybench (
${
prettyMs
(
WARMUP_DURATION_MS
)}
built-in warmup)...\n`
)
await
bench
.
run
()
const
latency
=
bench
.
tasks
[
0
]?.
result
?.
latency
const
durations
=
Array
.
isArray
(
latency
?.
samples
)
?
[...
latency
.
samples
]
:
[]
const
stats
=
latency
&&
typeof
latency
.
min
===
'number'
&&
typeof
latency
.
max
===
'number'
&&
typeof
latency
.
mean
===
'number'
&&
typeof
latency
.
p50
===
'number'
&&
typeof
latency
.
p75
===
'number'
&&
typeof
latency
.
p95
===
'number'
&&
typeof
latency
.
p99
===
'number'
?
{
min
:
latency
.
min
,
max
:
latency
.
max
,
avg
:
latency
.
mean
,
p50
:
latency
.
p50
,
p75
:
latency
.
p75
,
p95
:
latency
.
p95
,
p99
:
latency
.
p99
,
}
:
statistics
(
durations
)
console
.
log
(
'Results:'
)
console
.
log
(
'─'
.
repeat
(
40
))
...
...
bench/table-1000-items-client-component/package.json
View file @
88d412a7
...
...
@@ -11,6 +11,7 @@
},
"devDependencies"
:
{
"@types/react"
:
"^19.0.0"
,
"tinybench"
:
"^6.0.0"
,
"typescript"
:
"^5.0.0"
,
"pretty-ms"
:
"^7.0.1"
}
...
...
bench/table-1000-items-server-component/bench.mjs
View file @
88d412a7
...
...
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'url'
import
{
promises
as
fs
}
from
'fs'
import
prettyMs
from
'pretty-ms'
import
treeKill
from
'tree-kill'
import
{
Bench
}
from
'tinybench'
const
__dirname
=
dirname
(
fileURLToPath
(
import
.
meta
.
url
))
const
ROOT_DIR
=
join
(
__dirname
,
'..'
,
'..'
)
...
...
@@ -126,26 +127,56 @@ async function main() {
const
instance
=
await
startServer
()
try
{
// Warmup phase: send requests continuously for WARMUP_DURATION_MS
console
.
log
(
`\nWarming up for
${
prettyMs
(
WARMUP_DURATION_MS
)}
...`
)
let
warmupCount
=
0
const
warmupEnd
=
performance
.
now
()
+
WARMUP_DURATION_MS
while
(
performance
.
now
()
<
warmupEnd
)
{
await
measureRequest
(
URL
)
warmupCount
++
}
console
.
log
(
`Warmup complete (
${
warmupCount
}
requests)`
)
// Benchmark requests
console
.
log
(
`\nRunning
${
BENCH_REQUESTS
}
benchmark requests...\n`
)
const
durations
=
[]
// Benchmark requests using tinybench built-in warmup.
console
.
log
(
`\nPreparing tinybench benchmark...`
)
const
bench
=
new
Bench
({
name
:
'table-1000-items-server-component'
,
time
:
0
,
iterations
:
BENCH_REQUESTS
,
warmup
:
true
,
warmupTime
:
WARMUP_DURATION_MS
,
retainSamples
:
true
,
throws
:
true
,
})
for
(
let
i
=
0
;
i
<
BENCH_REQUESTS
;
i
++
)
{
const
duration
=
await
measureRequest
(
URL
)
durations
.
push
(
duration
)
}
bench
.
add
(
'request'
,
async
()
=>
{
await
measureRequest
(
URL
)
},
{
async
:
true
,
}
)
const
stats
=
statistics
(
durations
)
console
.
log
(
`\nRunning
${
BENCH_REQUESTS
}
benchmark requests with tinybench (
${
prettyMs
(
WARMUP_DURATION_MS
)}
built-in warmup)...\n`
)
await
bench
.
run
()
const
latency
=
bench
.
tasks
[
0
]?.
result
?.
latency
const
durations
=
Array
.
isArray
(
latency
?.
samples
)
?
[...
latency
.
samples
]
:
[]
const
stats
=
latency
&&
typeof
latency
.
min
===
'number'
&&
typeof
latency
.
max
===
'number'
&&
typeof
latency
.
mean
===
'number'
&&
typeof
latency
.
p50
===
'number'
&&
typeof
latency
.
p75
===
'number'
&&
typeof
latency
.
p95
===
'number'
&&
typeof
latency
.
p99
===
'number'
?
{
min
:
latency
.
min
,
max
:
latency
.
max
,
avg
:
latency
.
mean
,
p50
:
latency
.
p50
,
p75
:
latency
.
p75
,
p95
:
latency
.
p95
,
p99
:
latency
.
p99
,
}
:
statistics
(
durations
)
console
.
log
(
'Results:'
)
console
.
log
(
'─'
.
repeat
(
40
))
...
...
bench/table-1000-items-server-component/package.json
View file @
88d412a7
...
...
@@ -11,6 +11,7 @@
},
"devDependencies"
:
{
"@types/react"
:
"^19.0.0"
,
"tinybench"
:
"^6.0.0"
,
"typescript"
:
"^5.0.0"
,
"pretty-ms"
:
"^7.0.1"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment