From 0b9e83cc8453df2e98f06d09d0c8acb7b0c94c56 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Thu, 21 Dec 2023 06:11:54 +0900 Subject: [PATCH] Benchmark on AMD 7940HS --- .../README.md | 207 ++++++++++++++++++ .../images/assert-error.svg | 1 + .../images/assert.svg | 1 + .../images/is.svg | 1 + .../images/optimizer.svg | 1 + .../images/server-assert.svg | 1 + .../images/server-performance.svg | 1 + .../images/server-stringify.svg | 1 + .../images/stringify.svg | 1 + .../images/validate-error.svg | 1 + .../images/validate.svg | 1 + benchmark/src/internal/BenchmarktReporter.ts | 2 +- 12 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/README.md create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert-error.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/is.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/optimizer.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-assert.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-performance.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-stringify.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/stringify.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate-error.svg create mode 100644 benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate.svg diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/README.md b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/README.md new file mode 100644 index 0000000000..2135d3eadb --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/README.md @@ -0,0 +1,207 @@ +# Benchmark of `typia` +> - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics +> - Memory: 31,954 MB +> - OS: win32 +> - NodeJS version: v20.10.0 +> - Typia version: v5.3.5 + + +## is +![is benchmark](images/is.svg) + + Types | typia | typebox | ajv | io-ts | zod | class-validator +-------|------|------|------|------|------|------ + object (simple) | 202,897 | 206,304 | 7,997 | 841 | 125 | 10 + object (hierarchical) | 51,903 | 36,816 | 10,211 | 1,307 | 65 | 20 + object (recursive) | 20,193 | 21,930 | 4,870 | 1,185 | 11 | 19 + object (union, explicit) | 4,455 | 2,781 | 233 | 685 | 6.24 | - + object (union, implicit) | 4,523 | - | - | - | - | - + array (recursive) | 10,170 | 11,859 | 4,143 | 1,272 | 15 | 15 + array (union, explicit) | 4,496 | 2,614 | 418 | 463 | 2.93 | - + array (union, implicit) | 3,440 | - | - | - | - | - + ultimate union | 2,111 | - | - | - | - | - + +> Unit: Megabytes/sec + + + + +## assert +![assert benchmark](images/assert.svg) + + Types | typia | typebox | ajv | io-ts | zod | class-validator +-------|------|------|------|------|------|------ + object (simple) | 204,764 | 206,391 | 8,031 | 843 | 126 | 11 + object (hierarchical) | 45,892 | 35,662 | 10,116 | 1,315 | 64 | 14 + object (recursive) | 19,025 | 21,820 | 4,900 | 1,200 | 12 | 19 + object (union, explicit) | 4,474 | 2,900 | 229 | 675 | 6.28 | - + object (union, implicit) | 4,413 | - | - | - | - | - + array (recursive) | 10,003 | 11,707 | 4,220 | 1,280 | 16 | 15 + array (union, explicit) | 4,550 | 2,637 | 397 | 463 | 2.95 | - + array (union, implicit) | 3,440 | - | - | - | - | - + ultimate union | 2,057 | - | - | - | - | - + +> Unit: Megabytes/sec + + + + +## validate +![validate benchmark](images/validate.svg) + + Types | typia | typebox | ajv | io-ts | zod | class-validator +-------|------|------|------|------|------|------ + object (simple) | 200,840 | 202,730 | 7,922 | 851 | 126 | 10 + object (hierarchical) | 28,741 | 35,827 | 9,397 | 1,296 | 65 | 20 + object (recursive) | 19,742 | 21,589 | 4,953 | 1,216 | 11 | 19 + object (union, explicit) | 4,471 | 3,016 | 139 | 639 | 6.29 | - + object (union, implicit) | 4,054 | - | - | - | - | - + array (recursive) | 10,611 | 11,684 | 3,809 | 1,266 | 15 | 15 + array (union, explicit) | 4,541 | 2,641 | 182 | 463 | 2.93 | - + array (union, implicit) | 3,474 | - | - | - | - | - + ultimate union | 2,069 | - | - | - | - | - + +> Unit: Megabytes/sec + + + + +## assert-error +![assert-error benchmark](images/assert-error.svg) + + Types | typia | typebox | io-ts | zod | class-validator +-------|------|------|------|------|------ + object (simple) | 875 | 36 | 200 | 119 | 7.00 + object (hierarchical) | 3,401 | 81 | 326 | 62 | 12 + object (recursive) | 2,754 | 58 | 213 | 11 | 12 + object (union, explicit) | 790 | 21 | 144 | 5.92 | - + object (union, implicit) | 596 | - | - | - | - + array (recursive) | 1,644 | 53 | 138 | 12 | 5.89 + array (union, explicit) | 1,498 | 15 | 64 | 2.36 | - + array (union, implicit) | 1,283 | - | - | - | - + ultimate union | 465 | - | - | - | - + +> Unit: Megabytes/sec + + + + +## validate-error +![validate-error benchmark](images/validate-error.svg) + + Types | typia | typebox | io-ts | zod | class-validator +-------|------|------|------|------|------ + object (simple) | 1,774 | 34 | 235 | 118 | 6.84 + object (hierarchical) | 3,501 | 78 | 333 | 60 | 12 + object (recursive) | 2,483 | 57 | 216 | 10 | 11 + object (union, explicit) | 703 | 20 | 140 | 5.90 | - + object (union, implicit) | 495 | - | - | - | - + array (recursive) | 1,190 | 54 | 195 | 13 | 6.39 + array (union, explicit) | 1,343 | 15 | 67 | 2.85 | - + array (union, implicit) | 1,018 | - | - | - | - + ultimate union | 330 | - | - | - | - + +> Unit: Megabytes/sec + + + + +## optimizer +![optimizer benchmark](images/optimizer.svg) + + Types | typia | typebox | ajv | class-validator +-------|------|------|------|------ + object (simple) | 199,683 | 8.76 | 0.03 | 10 + object (hierarchical) | 49,403 | 16 | 0.15 | 19 + object (recursive) | 22,383 | 88 | 0.32 | 18 + object (union, explicit) | 4,405 | 19 | 0.16 | 19 + array (simple) | 16,308 | 223 | 0.61 | 42 + array (hierarchical) | 34,076 | 576 | 5.61 | 34 + array (recursive) | 10,450 | 945 | 3.37 | 15 + array (union, explicit) | 7,166 | 190 | 1.05 | 49 + +> Unit: Megabytes/sec + + + + +## stringify +![stringify benchmark](images/stringify.svg) + + Types | typia.stringify | typia.isStringify | typia.assertStringify | fast-json-stringify | JSON.stringify | class-transformer +-------|------|------|------|------|------|------ + object (simple) | 2,358 | 1,711 | 1,715 | 714 | 121 | 9.63 + object (hierarchical) | 840 | 847 | 815 | 519 | 193 | 19 + object (recursive) | 957 | 823 | 901 | 274 | 196 | 18 + object (union, explicit) | 299 | 254 | 261 | 222 | 112 | 7.52 + array (simple) | 360 | 352 | 351 | 627 | 237 | 18 + array (hierarchical) | 452 | 444 | 452 | 801 | 204 | 15 + array (recursive) | 408 | 396 | 378 | 823 | 192 | 16 + array (union, explicit) | 321 | 300 | 306 | 81 | 258 | 15 + +> Unit: Megabytes/sec + + + + +## server-assert +![server-assert benchmark](images/server-assert.svg) + + Types | fastify-typia | fastify-pure | fastify-class-transformer | express-typia | express-class-transformer +-------|------|------|------|------|------ + object (simple) | 90 | 85 | 7.13 | 51 | 6.10 + object (hierarchical) | 165 | 162 | 12 | 134 | 12 + object (recursive) | 165 | 154 | 11 | 137 | 10 + object (union, explicit) | 107 | 69 | 4.35 | 83 | 4.20 + array (simple) | 152 | 149 | 11 | 129 | 9.73 + array (hierarchical) | 94 | 96 | 5.95 | 128 | 7.47 + array (recursive) | 122 | 122 | 8.29 | 115 | 8.02 + array (union, explicit) | 139 | 100 | 7.97 | 141 | 7.77 + +> Unit: Megabytes/sec + + + + +## server-stringify +![server-stringify benchmark](images/server-stringify.svg) + + Types | fastify-typia | fastify-pure | fastify-class-transformer | express-typia | express-pure | express-class-transformer +-------|------|------|------|------|------|------ + object (simple) | 139 | 136 | 8.57 | 71 | 53 | 7.28 + object (hierarchical) | 199 | 179 | 16 | 176 | 120 | 15 + object (recursive) | 222 | 119 | 14 | 182 | 131 | 11 + object (union, explicit) | 158 | 93 | 5.52 | 135 | 90 | 5.80 + array (simple) | 152 | 167 | 14 | 150 | 141 | 13 + array (hierarchical) | 163 | 75 | 12 | 169 | 128 | 11 + array (recursive) | 137 | 85 | 11 | 141 | 124 | 11 + array (union, explicit) | 150 | 35 | 12 | 136 | 151 | 12 + +> Unit: Megabytes/sec + + + + +## server-performance +![server-performance benchmark](images/server-performance.svg) + + Types | fastify-typia | fastify-pure | fastify-class-transformer | express-typia | express-class-transformer +-------|------|------|------|------|------ + object (simple) | 126 | 118 | 9.38 | 78 | 12 + object (hierarchical) | 198 | 176 | 17 | 159 | 23 + object (recursive) | 187 | 130 | 15 | 160 | 22 + object (union, explicit) | 128 | 77 | 4.23 | 105 | 4.23 + array (simple) | 157 | 154 | 11 | 141 | 11 + array (hierarchical) | 145 | 105 | 7.95 | 147 | 6.37 + array (recursive) | 131 | 131 | 11 | 129 | 16 + array (union, explicit) | 151 | 54 | 8.11 | 136 | 7.96 + +> Unit: Megabytes/sec + + + + + + + +Total elapsed time: 4,365,887 ms diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert-error.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert-error.svg new file mode 100644 index 0000000000..68ee767f2d --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert-error.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) object (union, implicit) array (recursive) array (union, explicit) array (union, implicit) ultimate union 0x100x200x300x400x500x600xassert-error benchmarktypiatypeboxio-tszodclass-validator - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.5125x5x29x17x1x273x6x26x5x1x259x5x20x1x1x133x4x24x1xFailedInfinityFailedFailedFailedFailed279x9x23x2x1x635x7x27x1xFailedInfinityFailedFailedFailedFailedInfinityFailedFailedFailedFailed \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert.svg new file mode 100644 index 0000000000..ac48a3271e --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/assert.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) object (union, implicit) array (recursive) array (union, explicit) array (union, implicit) ultimate union 0x5,000x10,000x15,000x20,000xassert benchmarktypiatypeboxajvio-tszodclass-validator - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.518,742x18,891x735x77x11x1x3,310x2,572x730x95x5x1x1,631x1,871x420x103x1x2x713x462x37x108x1xFailedInfinityFailedFailedFailedFailedFailed689x806x291x88x1x1x1,543x894x135x157x1xFailedInfinityFailedFailedFailedFailedFailedInfinityFailedFailedFailedFailedFailed \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/is.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/is.svg new file mode 100644 index 0000000000..94df22bae0 --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/is.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) object (union, implicit) array (recursive) array (union, explicit) array (union, implicit) ultimate union 0x5,000x10,000x15,000x20,000xis benchmarktypiatypeboxajvio-tszodclass-validator - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.519,610x19,940x773x81x12x1x2,613x1,854x514x66x3x1x1,762x1,913x425x103x1x2x714x446x37x110x1xFailedInfinityFailedFailedFailedFailedFailed676x789x275x85x1x1x1,535x893x143x158x1xFailedInfinityFailedFailedFailedFailedFailedInfinityFailedFailedFailedFailedFailed \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/optimizer.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/optimizer.svg new file mode 100644 index 0000000000..faaaa64b05 --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/optimizer.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) array (simple) array (hierarchical) array (recursive) array (union, explicit) 0x1,000,000x2,000,000x3,000,000x4,000,000x5,000,000x6,000,000xoptimizer benchmarktypiatypeboxajvclass-validator - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.55,867,946x257x1x300x325,496x108x1x125x69,347x273x1x55x27,511x117x1x119x26,582x363x1x68x6,077x103x1x6x3,102x281x1x4x6,824x181x1x47x \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-assert.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-assert.svg new file mode 100644 index 0000000000..ad320e47f3 --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-assert.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) array (simple) array (hierarchical) array (recursive) array (union, explicit) 0x5x10x15x20x25xserver-assert benchmarkfastify-typiafastify-purefastify-class-transformerexpress-typiaexpress-class-transformer - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.514.82x13.99x1.17x8.31x1x14x13.77x1.04x11.38x1x16.13x15.05x1.07x13.39x1x25.57x16.4x1.03x19.67x1x15.62x15.26x1.1x13.26x1x15.76x16.07x1x21.47x1.26x15.16x15.23x1.03x14.38x1x17.83x12.82x1.02x18.1x1x \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-performance.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-performance.svg new file mode 100644 index 0000000000..c9358b689c --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-performance.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) array (simple) array (hierarchical) array (recursive) array (union, explicit) 0x5x10x15x20x25x30xserver-performance benchmarkfastify-typiafastify-purefastify-class-transformerexpress-typiaexpress-class-transformer - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.513.48x12.61x1x8.32x1.32x11.38x10.11x1x9.14x1.35x12.42x8.67x1x10.62x1.49x30.21x18.27x1x24.89x1x14.45x14.14x1.02x12.92x1x22.81x16.51x1.25x23.06x1x12.4x12.39x1x12.2x1.54x18.98x6.84x1.02x17.05x1x \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-stringify.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-stringify.svg new file mode 100644 index 0000000000..9dd6d11428 --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/server-stringify.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) array (simple) array (hierarchical) array (recursive) array (union, explicit) 0x5x10x15x20x25x30xserver-stringify benchmarkfastify-typiafastify-purefastify-class-transformerexpress-typiaexpress-pureexpress-class-transformer - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.519.03x18.65x1.18x9.81x7.23x1x12.95x11.6x1.04x11.43x7.8x1x20.5x11.02x1.27x16.8x12.1x1x28.57x16.89x1x24.52x16.31x1.05x11.52x12.66x1.05x11.35x10.69x1x14.94x6.89x1.06x15.45x11.72x1x12.07x7.48x1x12.37x10.87x1x12.49x2.94x1x11.33x12.53x1.02x \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/stringify.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/stringify.svg new file mode 100644 index 0000000000..6342f0b06e --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/stringify.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) array (simple) array (hierarchical) array (recursive) array (union, explicit) 0x50x100x150x200x250xstringify benchmarktypia.stringifytypia.isStringifytypia.assertStringifyfast-json-stringifyJSON.stringifyclass-transformer - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.5245x178x178x74x13x1x43x44x42x27x10x1x55x47x51x16x11x1x40x34x35x29x15x1x20x20x20x35x13x1x31x31x31x55x14x1x26x26x24x53x12x1x21x19x20x5x17x1x \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate-error.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate-error.svg new file mode 100644 index 0000000000..e5356dd6d1 --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate-error.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) object (union, implicit) array (recursive) array (union, explicit) array (union, implicit) ultimate union 0x100x200x300x400x500xvalidate-error benchmarktypiatypeboxio-tszodclass-validator - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.5259x5x34x17x1x284x6x27x5x1x239x6x21x1x1x119x3x24x1xFailedInfinityFailedFailedFailedFailed186x9x31x2x1x471x5x23x1xFailedInfinityFailedFailedFailedFailedInfinityFailedFailedFailedFailed \ No newline at end of file diff --git a/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate.svg b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate.svg new file mode 100644 index 0000000000..b09c06058b --- /dev/null +++ b/benchmark/results/AMD Ryzen 9 7940HS w Radeon 780M Graphics/images/validate.svg @@ -0,0 +1 @@ +object (simple) object (hierarchical) object (recursive) object (union, explicit) object (union, implicit) array (recursive) array (union, explicit) array (union, implicit) ultimate union 0x5,000x10,000x15,000x20,000xvalidate benchmarktypiatypeboxajvio-tszodclass-validator - CPU: AMD Ryzen 9 7940HS w/ Radeon 780M Graphics - OS: win32 - RAM: 31 GB - NodeJS version: v20.10.0 - Typia version: v5.3.519,184x19,365x757x81x12x1x1,467x1,829x480x66x3x1x1,741x1,903x437x107x1x2x711x479x22x102x1xFailedInfinityFailedFailedFailedFailedFailed720x793x259x86x1x1x1,548x900x62x158x1xFailedInfinityFailedFailedFailedFailedFailedInfinityFailedFailedFailedFailedFailed \ No newline at end of file diff --git a/benchmark/src/internal/BenchmarktReporter.ts b/benchmark/src/internal/BenchmarktReporter.ts index 4b9d7f7b8d..76950176e0 100644 --- a/benchmark/src/internal/BenchmarktReporter.ts +++ b/benchmark/src/internal/BenchmarktReporter.ts @@ -91,7 +91,7 @@ export namespace BenchmarkReporter { : `${__dirname}/../../../benchmark/results`; const cpu: string = os.cpus()[0].model.trim(); - const location: string = `${results}/${cpu}`; + const location: string = `${results}/${cpu.split("\\").join("").split("/").join("")}`; await mkdir(results); await mkdir(location);