generated from napi-rs/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update benchmark framework and result (#939)
- Loading branch information
1 parent
f1a7d7d
commit 6645e30
Showing
8 changed files
with
123 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,50 +114,44 @@ writeFileSync(join(__dirname, 'draw-emoji.png'), b) | |
硬件信息: | ||
|
||
``` | ||
OS: Windows 10 x86_64 | ||
Host: Micro-Star International Co., Ltd. MS-7C35 | ||
Kernel: 10.0.19043 | ||
Terminal: Windows Terminal | ||
CPU: AMD Ryzen 9 5950X (32) @ 3.400GHz | ||
Memory: 32688MiB | ||
,MMMM. Host - xxxxxxxxxxxxxxxxxxxxxxx | ||
.MMMMMM Machine - Mac15,9 | ||
MMMMM, Kernel - 24.0.0 | ||
.;MMMMM:' MMMMMMMMMM;. OS - macOS 15.0.1 Sequoia | ||
MMMMMMMMMMMMNWMMMMMMMMMMM: DE - Aqua | ||
.MMMMMMMMMMMMMMMMMMMMMMMMWM. WM - Quartz Compositor | ||
MMMMMMMMMMMMMMMMMMMMMMMMM. Packages - 194 (Homebrew), 32 (cargo) | ||
;MMMMMMMMMMMMMMMMMMMMMMMM: Shell - zsh | ||
:MMMMMMMMMMMMMMMMMMMMMMMM: Terminal - warpterminal (Version v0.2024.10.23.14.49.stable_00) | ||
.MMMMMMMMMMMMMMMMMMMMMMMMM. Resolution - 5120x2880@160fps (as 2560x1440) | ||
MMMMMMMMMMMMMMMMMMMMMMMMMMM. 2992x1934@120fps (as 1496x967) | ||
.MMMMMMMMMMMMMMMMMMMMMMMMMM. 2232x1512@60fps (as 1116x756) | ||
MMMMMMMMMMMMMMMMMMMMMMMM Uptime - 1d 2h 32m | ||
;MMMMMMMMMMMMMMMMMMMM. CPU - Apple M3 Max (16) | ||
.MMMM,. .MMMM,. CPU Load - 16% | ||
Memory - 50.1 GB / 134.2 GB | ||
Battery - 78% & Discharging | ||
Disk Space - 624.0 GB / 994.7 GB | ||
``` | ||
|
||
``` | ||
❯ yarn bench | ||
> @napi-rs/[email protected] bench D:\workspace\skia-rs | ||
> node -r @swc-node/register benchmark/bench.ts | ||
Running "Draw house" suite... | ||
Progress: 100% | ||
skia-canvas: | ||
26 ops/s, ±0.70% | slowest, 29.73% slower | ||
node-canvas: | ||
30 ops/s, ±6.95% | 18.92% slower | ||
@napi-rs/canvas: | ||
37 ops/s, ±6.30% | fastest | ||
Finished 3 cases! | ||
Fastest: @napi-rs/canvas | ||
Slowest: skia-canvas | ||
Running "Draw gradient" suite... | ||
Progress: 100% | ||
skia-canvas: | ||
36 ops/s, ±6.12% | 14.29% slower | ||
node-canvas: | ||
34 ops/s, ±5.60% | slowest, 19.05% slower | ||
@napi-rs/canvas: | ||
42 ops/s, ±0.53% | fastest | ||
Finished 3 cases! | ||
Fastest: @napi-rs/canvas | ||
Slowest: node-canvas | ||
Draw a House and export to PNG | ||
┌─────────┬─────────────────┬───────────────────────┬──────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐ | ||
│ (index) │ Task name │ Latency average (ns) │ Latency median (ns) │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │ | ||
├─────────┼─────────────────┼───────────────────────┼──────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤ | ||
│ 0 │ '@napi-rs/skia' │ '14676992.14 ± 0.68%' │ '14602333.00' │ '68 ± 0.59%' │ '68' │ 69 │ | ||
│ 1 │ 'skia-canvas' │ '21167809.17 ± 2.05%' │ '20960021.00 ± 13646.00' │ '47 ± 1.31%' │ '48' │ 64 │ | ||
│ 2 │ 'node-canvas' │ '16552027.42 ± 0.70%' │ '16451291.50 ± 2208.50' │ '60 ± 0.62%' │ '61' │ 64 │ | ||
└─────────┴─────────────────┴───────────────────────┴──────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘ | ||
Draw Gradient and export to PNG | ||
┌─────────┬─────────────────┬───────────────────────┬─────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐ | ||
│ (index) │ Task name │ Latency average (ns) │ Latency median (ns) │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │ | ||
├─────────┼─────────────────┼───────────────────────┼─────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤ | ||
│ 0 │ '@napi-rs/skia' │ '15228495.58 ± 0.53%' │ '15146312.50 ± 1187.50' │ '66 ± 0.48%' │ '66' │ 66 │ | ||
│ 1 │ 'skia-canvas' │ '21725564.41 ± 2.20%' │ '21412520.50 ± 2104.50' │ '46 ± 1.39%' │ '47' │ 64 │ | ||
│ 2 │ 'node-canvas' │ '17976022.14 ± 1.53%' │ '17563479.50 ± 5104.50' │ '56 ± 1.38%' │ '57' │ 64 │ | ||
└─────────┴─────────────────┴───────────────────────┴─────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘ | ||
``` | ||
|
||
# 功能 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,50 +131,44 @@ See [benchmark](./benchmark) for benchmark code. | |
Hardware info: | ||
|
||
``` | ||
OS: Windows 10 x86_64 | ||
Host: Micro-Star International Co., Ltd. MS-7C35 | ||
Kernel: 10.0.19043 | ||
Terminal: Windows Terminal | ||
CPU: AMD Ryzen 9 5950X (32) @ 3.400GHz | ||
Memory: 32688MiB | ||
,MMMM. Host - xxxxxxxxxxxxxxxxxxxxxxx | ||
.MMMMMM Machine - Mac15,9 | ||
MMMMM, Kernel - 24.0.0 | ||
.;MMMMM:' MMMMMMMMMM;. OS - macOS 15.0.1 Sequoia | ||
MMMMMMMMMMMMNWMMMMMMMMMMM: DE - Aqua | ||
.MMMMMMMMMMMMMMMMMMMMMMMMWM. WM - Quartz Compositor | ||
MMMMMMMMMMMMMMMMMMMMMMMMM. Packages - 194 (Homebrew), 32 (cargo) | ||
;MMMMMMMMMMMMMMMMMMMMMMMM: Shell - zsh | ||
:MMMMMMMMMMMMMMMMMMMMMMMM: Terminal - warpterminal (Version v0.2024.10.23.14.49.stable_00) | ||
.MMMMMMMMMMMMMMMMMMMMMMMMM. Resolution - 5120x2880@160fps (as 2560x1440) | ||
MMMMMMMMMMMMMMMMMMMMMMMMMMM. 2992x1934@120fps (as 1496x967) | ||
.MMMMMMMMMMMMMMMMMMMMMMMMMM. 2232x1512@60fps (as 1116x756) | ||
MMMMMMMMMMMMMMMMMMMMMMMM Uptime - 1d 2h 32m | ||
;MMMMMMMMMMMMMMMMMMMM. CPU - Apple M3 Max (16) | ||
.MMMM,. .MMMM,. CPU Load - 16% | ||
Memory - 50.1 GB / 134.2 GB | ||
Battery - 78% & Discharging | ||
Disk Space - 624.0 GB / 994.7 GB | ||
``` | ||
|
||
``` | ||
❯ yarn bench | ||
> @napi-rs/[email protected] bench D:\workspace\skia-rs | ||
> node -r @swc-node/register benchmark/bench.ts | ||
Running "Draw house" suite... | ||
Progress: 100% | ||
skia-canvas: | ||
26 ops/s, ±0.70% | slowest, 29.73% slower | ||
node-canvas: | ||
30 ops/s, ±6.95% | 18.92% slower | ||
@napi-rs/canvas: | ||
37 ops/s, ±6.30% | fastest | ||
Finished 3 cases! | ||
Fastest: @napi-rs/canvas | ||
Slowest: skia-canvas | ||
Running "Draw gradient" suite... | ||
Progress: 100% | ||
skia-canvas: | ||
36 ops/s, ±6.12% | 14.29% slower | ||
node-canvas: | ||
34 ops/s, ±5.60% | slowest, 19.05% slower | ||
@napi-rs/canvas: | ||
42 ops/s, ±0.53% | fastest | ||
Finished 3 cases! | ||
Fastest: @napi-rs/canvas | ||
Slowest: node-canvas | ||
Draw a House and export to PNG | ||
┌─────────┬─────────────────┬───────────────────────┬──────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐ | ||
│ (index) │ Task name │ Latency average (ns) │ Latency median (ns) │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │ | ||
├─────────┼─────────────────┼───────────────────────┼──────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤ | ||
│ 0 │ '@napi-rs/skia' │ '14676992.14 ± 0.68%' │ '14602333.00' │ '68 ± 0.59%' │ '68' │ 69 │ | ||
│ 1 │ 'skia-canvas' │ '21167809.17 ± 2.05%' │ '20960021.00 ± 13646.00' │ '47 ± 1.31%' │ '48' │ 64 │ | ||
│ 2 │ 'node-canvas' │ '16552027.42 ± 0.70%' │ '16451291.50 ± 2208.50' │ '60 ± 0.62%' │ '61' │ 64 │ | ||
└─────────┴─────────────────┴───────────────────────┴──────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘ | ||
Draw Gradient and export to PNG | ||
┌─────────┬─────────────────┬───────────────────────┬─────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐ | ||
│ (index) │ Task name │ Latency average (ns) │ Latency median (ns) │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │ | ||
├─────────┼─────────────────┼───────────────────────┼─────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤ | ||
│ 0 │ '@napi-rs/skia' │ '15228495.58 ± 0.53%' │ '15146312.50 ± 1187.50' │ '66 ± 0.48%' │ '66' │ 66 │ | ||
│ 1 │ 'skia-canvas' │ '21725564.41 ± 2.20%' │ '21412520.50 ± 2104.50' │ '46 ± 1.39%' │ '47' │ 64 │ | ||
│ 2 │ 'node-canvas' │ '17976022.14 ± 1.53%' │ '17563479.50 ± 5104.50' │ '56 ± 1.38%' │ '57' │ 64 │ | ||
└─────────┴─────────────────┴───────────────────────┴─────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘ | ||
``` | ||
|
||
# Features | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
import { promises as fs } from 'fs' | ||
import { join } from 'path' | ||
|
||
import { Summary } from 'benny/lib/internal/common-types' | ||
|
||
import { house } from './house' | ||
import { gradient } from './gradient' | ||
|
||
async function run() { | ||
const output = [await house(), await gradient()].map(formatSummary).join('\n') | ||
await fs.writeFile(join(process.cwd(), 'bench.txt'), output, 'utf8') | ||
await house() | ||
await gradient() | ||
} | ||
|
||
run().catch((e) => { | ||
console.error(e) | ||
}) | ||
|
||
function formatSummary(summary: Summary): string { | ||
return summary.results | ||
.map( | ||
(result) => | ||
`${summary.name}#${result.name} x ${result.ops} ops/sec ±${result.margin}% (${result.samples} runs sampled)`, | ||
) | ||
.join('\n') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.