Skip to content

Commit

Permalink
Measure #574 and #578 on AMD-6800HS
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Apr 9, 2023
1 parent 01700cb commit d6c0261
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 58 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function prune<T extends object>(input: T): void; // erase extra props

All functions in `typia` require **only one line**. You don't need any extra dedication like JSON schema definitions or decorator function calls. Just call `typia` function with only one line like `typia.assert<T>(input)`.

Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **15,000x faster** than `class-validator`.
Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **20,000x faster** than `class-validator`.

![Is Function Benchmark](https://github.com/samchon/typia/raw/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz/images/is.svg)

Expand Down Expand Up @@ -250,7 +250,7 @@ export function createAssertStringify<T>(): (input: T) => string;
- `application()`: generate JSON schema with only one line
- you can complement JSON schema contents through [comment tags](https://github.com/samchon/typia/wiki/Enhanced-JSON#comment-tags)
- `assertParse()`: parse JSON string safely with type validation
- `isStringify()`: maximum 10x faster JSON stringify fuction even type safe
- `isStringify()`: maximum 160x faster JSON stringify fuction even type safe

![JSON string conversion speed](https://raw.githubusercontent.com/samchon/typia/master/benchmark/results/AMD%20Ryzen%207%206800HS%20with%20Radeon%20Graphics/images/stringify.svg)

Expand Down Expand Up @@ -286,8 +286,8 @@ If you need specific random data generation, utilize comment tags or do customiz
[Nestia](https://github.com/samchon/nestia) is a set of helper libraries for `NestJS`, supporting below features:

- `@nestia/core`: superfast decorators using `typia`
- **15,000x faster** validation
- **100x faster** JSON serialization
- **20,000x faster** validation
- **200x faster** JSON serialization
- `@nestia/sdk`: evolved **SDK** and **Swagger** generators
- SDK (Software Development Kit)
- interaction library for client developers
Expand Down
179 changes: 134 additions & 45 deletions benchmark/results/AMD Ryzen 7 6800HS with Radeon Graphics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,167 @@
> - Memory: 64,780 MB
> - OS: win32
> - NodeJS version: v16.19.0
> - Typia version: 3.7.2
> - Typia version: v3.7.3

## is
![is benchmark](images/is.svg)

Types | typia | typebox | ajv | io-ts | zod | class-validator
-------|------|------|------|------|------|------
object (simple) | 10,563,398.072 | 10,661,040.97 | 504,444.079 | 40,502.625 | 3,973.613 | 526.586
object (hierarchical) | 317,862.574 | 317,463.457 | 61,567.11 | 10,172.744 | 482.624 | 116.503
object (recursive) | 129,432.613 | 143,353.398 | 54,178.992 | 7,102.022 | 82.14 | 99.55
object (union, explicit) | 27,537.804 | 18,519.206 | 9,500.091 | 4,261.039 | 39.181 | 89.934
object (union, implicit) | 16,930.414 | - | - | - | - | -
array (recursive) | 8,547.632 | 10,931.251 | 2,494.235 | 730.475 | 10.171 | 8.774
array (union, explicit) | 3,441.794 | 2,451.536 | 924.893 | 434.107 | 3.311 | 33.158
array (union, implicit) | 3,071.243 | - | - | - | - | -
ultimate union | 531.729 | - | - | - | - | -
object (simple) | 1,336,957 | 1,311,578 | 64,693 | 5,179 | 673 | 64
object (hierarchical) | 268,145 | 279,146 | 51,568 | 8,362 | 449 | 98
object (recursive) | 152,893 | 153,391 | 56,748 | 7,779 | 92 | 106
object (union, explicit) | 27,216 | 19,409 | 9,846 | 4,379 | 45 | -
object (union, implicit) | 20,621 | - | - | - | - | -
array (recursive) | 100,511 | 117,415 | 28,173 | 7,918 | 117 | -
array (union, explicit) | 24,208 | 16,382 | 6,814 | 2,931 | 22 | -
array (union, implicit) | 30,627 | - | - | - | - | -
ultimate union | 8,095 | - | - | - | - | -

> Unit: Kilobytes/sec



## assert
![assert benchmark](images/assert.svg)

Types | typia | typebox | io-ts | zod | class-validator
-------|------|------|------|------|------
object (simple) | 456,283.333 | 3,046.165 | 19,157.59 | 3,892.877 | 518.453
object (hierarchical) | 112,182.922 | 888.473 | 4,440.299 | 491.14 | 116.163
object (recursive) | 63,503.43 | 522.673 | 2,194.567 | 82.364 | 104.05
object (union, explicit) | 7,279.255 | 208.425 | 1,413.231 | 39.796 | 93.728
object (union, implicit) | 6,626.468 | - | - | - | 79.001
array (recursive) | 2,525.414 | 52.311 | 238.841 | 10.036 | NaN
array (union, explicit) | 2,614.913 | 20.646 | 104.645 | 3.268 | 32.973
array (union, implicit) | 1,849.625 | - | - | - | 21.184
ultimate union | 263.567 | - | - | - | -
object (simple) | 1,317,336 | 1,323,300 | 4,888 | 677 | 64
object (hierarchical) | 271,109 | 279,921 | 8,349 | 465 | 98
object (recursive) | 137,108 | 158,127 | 7,536 | 92 | 112
object (union, explicit) | 26,715 | 18,871 | 4,366 | 46 | -
object (union, implicit) | 24,841 | - | - | - | -
array (recursive) | 94,935 | 121,161 | 8,090 | 121 | -
array (union, explicit) | 24,217 | 16,503 | 2,971 | 23 | -
array (union, implicit) | 30,225 | - | - | - | -
ultimate union | 7,682 | - | - | - | -

> Unit: Kilobytes/sec



## validate
![validate benchmark](images/validate.svg)

Types | typia | typebox | io-ts | zod | class-validator
-------|------|------|------|------|------
object (simple) | 121,124.63 | 2,788.953 | 19,480.132 | 4,034.401 | 511.39
object (hierarchical) | 40,611.01 | 908.561 | 4,354.68 | 496.431 | 115.623
object (recursive) | 23,123.587 | 510.611 | 2,232.28 | 82.172 | 99.371
object (union, explicit) | 5,622.021 | 210.228 | 1,469.225 | 39.072 | 91.375
object (union, implicit) | 4,276.746 | - | - | - | 81.784
array (recursive) | 1,466.384 | 55.33 | 237.06 | 10.127 | 8.607
array (union, explicit) | 1,911.361 | 21.051 | 104.537 | 3.253 | 33.961
array (union, implicit) | 1,271.824 | - | - | - | 21.598
ultimate union | 183.638 | - | - | - | -
object (simple) | 1,320,516 | 1,355,588 | 5,081 | 716 | 65
object (hierarchical) | 183,883 | 270,967 | 8,320 | 456 | 101
object (recursive) | 133,584 | 157,713 | 7,657 | 87 | 113
object (union, explicit) | 26,500 | 19,214 | 4,330 | 45 | -
object (union, implicit) | 22,794 | - | - | - | -
array (recursive) | 97,661 | 117,773 | 7,782 | 116 | -
array (union, explicit) | 24,204 | 16,202 | 2,972 | 23 | -
array (union, implicit) | 28,534 | - | - | - | -
ultimate union | 7,686 | - | - | - | -

> Unit: Kilobytes/sec



## assert-error
![assert-error benchmark](images/assert-error.svg)

Types | typia | typebox | io-ts | zod | class-validator
-------|------|------|------|------|------
object (simple) | 6,372 | 315 | 1,255 | 698 | 65
object (hierarchical) | 26,994 | 761 | 2,417 | 448 | 106
object (recursive) | 22,056 | 553 | 1,749 | 101 | 118
object (union, explicit) | 6,089 | 230 | 1,082 | 55 | -
object (union, implicit) | 4,514 | - | - | - | -
array (recursive) | 14,558 | 604 | 1,847 | 186 | -
array (union, explicit) | 9,914 | 239 | 636 | 89 | -
array (union, implicit) | 10,972 | - | - | - | -
ultimate union | 2,595 | - | - | - | -

> Unit: Kilobytes/sec



## validate-error
![validate-error benchmark](images/validate-error.svg)

Types | typia | typebox | io-ts | zod | class-validator
-------|------|------|------|------|------
object (simple) | 13,440 | 316 | 1,590 | 706 | 66
object (hierarchical) | 25,776 | 743 | 2,501 | 454 | 107
object (recursive) | 20,482 | 569 | 1,809 | 101 | 118
object (union, explicit) | 5,172 | 212 | 1,093 | 56 | -
object (union, implicit) | 3,639 | - | - | - | -
array (recursive) | 11,790 | 613 | 1,806 | 183 | -
array (union, explicit) | 8,548 | 241 | 633 | 86 | -
array (union, implicit) | 8,165 | - | - | - | -
ultimate union | 2,041 | - | - | - | -

> Unit: Kilobytes/sec



## optimizer
![optimizer benchmark](images/optimizer.svg)

Types | typia | typebox | ajv | class-validator
-------|------|------|------|------
object (simple) | 10,907,286.136 | 581.186 | 8.499 | 524.014
object (hierarchical) | 363,261.702 | 162.281 | 6.054 | 115.324
object (recursive) | 158,012.109 | 686.845 | 9.417 | 98.396
object (union, explicit) | 26,052.354 | 149.973 | 5.574 | 91.615
array (simple) | 55,518.396 | 754.634 | 8.861 | 71.675
array (hierarchical) | 10,243.634 | 426.247 | 7.93 | 7.164
array (recursive) | 11,420.857 | 782.257 | 9.737 | 8.556
array (union, explicit) | 7,968.534 | 220.906 | 5.563 | 32.76
object (simple) | 1,360,007 | 70 | 1 | 67
object (hierarchical) | 318,319 | 136 | 5 | 95
object (recursive) | 173,622 | 794 | 10 | 114
object (union, explicit) | 29,238 | 164 | 5 | 100
array (simple) | 120,290 | 481 | 11 | 239
array (hierarchical) | 233,773 | 13,974 | 92 | 195
array (recursive) | 151,263 | 8,503 | 106 | 97
array (union, explicit) | 55,641 | 1,567 | 39 | 237

> Unit: Kilobytes/sec



## stringify
![stringify benchmark](images/stringify.svg)

Types | typia.stringify | typia.isStringify | typia.assertStringify | fast-json-stringify | JSON.stringify | class-transformer
-------|------|------|------|------|------|------
object (simple) | 26,434.985 | 20,422.722 | 12,308.158 | 8,922.71 | 1,665.69 | 120.535
object (hierarchical) | 1,677.106 | 1,577.128 | 1,430.018 | 1,907.902 | 409.934 | 36.909
object (recursive) | 1,616.173 | 1,517.841 | 1,475.442 | 316.012 | 314.805 | 23.639
object (union, explicit) | 562.13 | 482.395 | 420.833 | 378.349 | 216.019 | 10.832
array (simple) | 280.259 | 329.759 | 223.843 | 402.74 | 188.934 | 18.468
array (hierarchical) | 47.469 | 24.461 | 29.927 | 65.83 | 11.972 | 0.874
array (recursive) | 71.244 | 66.546 | 64.658 | 34.382 | 33.821 | 2.364
array (union, explicit) | 95.03 | 86.901 | 84.716 | 63.672 | 70.045 | 3.272
object (simple) | 13,675 | 10,002 | 8,345 | 4,740 | 851 | 61
object (hierarchical) | 5,571 | 5,396 | 5,232 | 6,508 | 1,393 | 122
object (recursive) | 7,130 | 6,699 | 6,781 | 1,379 | 1,408 | 106
object (union, explicit) | 2,325 | 2,058 | 2,063 | 1,620 | 928 | 47
array (simple) | 2,697 | 2,440 | 2,486 | 4,022 | 1,843 | 118
array (hierarchical) | 3,557 | 3,487 | 3,559 | 5,372 | 1,627 | 97
array (recursive) | 3,139 | 3,084 | 3,047 | 1,530 | 1,477 | 104
array (union, explicit) | 2,799 | 2,513 | 2,548 | 1,773 | 1,938 | 92

> Unit: Kilobytes/sec



## server
![server benchmark](images/server.svg)

Types | express-typia | fastify | express-pure | express-class-transformer
-------|------|------|------|------
object (simple) | 60 | 111 | 45 | 5
object (hierarchical) | 140 | 197 | 103 | 11
object (recursive) | 155 | 106 | 107 | 9
object (union, explicit) | 121 | 82 | 74 | 4
array (simple) | 130 | 135 | 125 | 10
array (hierarchical) | 156 | 81 | 118 | 8
array (recursive) | 138 | 106 | 115 | 8
array (union, explicit) | 137 | 127 | 133 | 7

> Unit: Kilobytes/sec






> Total elapsed time: 1,530,459 ms
Total elapsed time: 1,772,859 ms
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d6c0261

Please sign in to comment.