Every package of Deepkit has benchmarks. The comparisons with other libraries use the same data and run in the same process, on a dedicated machine.
Operations per second, higher is better. Deepkit reads the TypeScript types at runtime, so there is no schema to write: the validators check a plain interface User. typia also uses TypeScript types, but generates its code at build time.
Checks a user object with nested profile and an array of roles. The result is true or false.
The same object with an invalid nested field. The result contains the errors with their path.
JSON-compatible data to a typed object: dates, nested objects, arrays.
A typed object to a JSON string.
Encoding and decoding of the same object to BSON, compared with the official bson package of the MongoDB driver.
Complete ORM operations against a real database on the same machine: a table with 10,000 rows, read as entities or objects of each library. Time per operation, the longer the bar the faster. The raw drivers (striped) are the lower bound of what an ORM on top of them can reach.
A row by its primary key.
All rows of the table as objects.
In one unit of work or batch, then deleted again.
A row by its primary key.
All rows of the table as objects.
In one unit of work or batch, then deleted again.
A row by its primary key.
All rows of the table as objects.
In one unit of work or batch, then deleted again.
Time per operation in the last releases and in master, the same benchmarks on the same machine, each with its change to the column before. Compared with 1.0.19, master is faster in 83, slower in 4 and unchanged within the measurement error in 316 of 403 benchmarks.
| 1.0.18 | 1.0.19 | master | |
|---|---|---|---|
is<User>() | 409 ns | 411 ns no change | 49 ns 8.3× faster |
validate<User>() with errors | 599 ns | 618 ns no change | 184 ns 3.4× faster |
serialize<User>() | 632 ns | 642 ns no change | 177 ns 3.6× faster |
deserialize<User>() | 694 ns | 690 ns no change | 191 ns 3.6× faster |
cast<User>() | 1.2 µs | 1.2 µs no change | 391 ns 3.1× faster |
deserialize<T[]>(), 100 items | 142 µs | 143 µs no change | 9.0 µs 15.8× faster |
HTTP body with 10 users | 115 µs | 111 µs no change | 4.4 µs 25.5× faster |
RPC message with body | 229 ns | 226 ns no change | 9.8 ns 23.1× faster |
Time per operation, lower is better, of whole features from the oldest measured release to master. White circles are releases. The factor compares master with the last release (1.0.19), grey if within the measurement error. Hover a point for its numbers.
Time per operation in master and the change of operations per second since the last release. Changes within twice the measurement error count as no change.
| createModule - empty | 29 µs | 34.8K ops/s | no change |
| createModule - with providers | 28 µs | 35.5K ops/s | no change |
| module class instantiation | 1.9 µs | 517K ops/s | no change |
| module class with config | 1.9 µs | 539K ops/s | no change |
| App creation - empty | 1.5 µs | 659K ops/s | +20% |
| App creation - with providers | 2.0 µs | 493K ops/s | +12% |
| App creation - with imports | 4.0 µs | 253K ops/s | no change |
| App.get() - resolve service | 130 ns | 7.7M ops/s | no change |
| App.get() - from imported module | 47 ns | 21.3M ops/s | no change |
| App.configure() | 2.6 µs | 384K ops/s | no change |
| App creation - nested imports | 6.0 µs | 168K ops/s | no change |
| App.setup() chain | 2.0 µs | 490K ops/s | no change |
| Module.configure() | 2.6 µs | 385K ops/s | no change |
| AppModule direct instantiation | 1.5 µs | 661K ops/s | no change |
| App creation - 5 module imports | 12 µs | 80.4K ops/s | no change |
| serialize small object | 396 ns | 2.5M ops/s | no change |
| deserialize small object | 449 ns | 2.2M ops/s | no change |
| serialize object with dates | 481 ns | 2.1M ops/s | no change |
| deserialize object with dates | 856 ns | 1.2M ops/s | no change |
| serialize nested object | 958 ns | 1.0M ops/s | no change |
| deserialize nested object | 1.0 µs | 986K ops/s | no change |
| serialize array (1000 items) | 703 µs | 1.4K ops/s | no change |
| deserialize array (1000 items) | 677 µs | 1.5K ops/s | no change |
| serialize array (5000 items) | 3.6 ms | 282 ops/s | no change |
| deserialize array (5000 items) | 4.2 ms | 240 ops/s | no change |
| serialize number array (1000) | 64 µs | 15.7K ops/s | no change |
| deserialize number array (1000) | 26 µs | 38.1K ops/s | no change |
| serialize string array (1000) | 529 µs | 1.9K ops/s | no change |
| deserialize string array (1000) | 277 µs | 3.6K ops/s | no change |
| serialize complex document | 3.1 µs | 325K ops/s | no change |
| deserialize complex document | 3.7 µs | 271K ops/s | no change |
| sync event - single listener | 17 ns | 58.0M ops/s | no change |
| sync event - no listeners | 18 ns | 55.4M ops/s | no change |
| async event - single sync listener | 364 ns | 2.7M ops/s | no change |
| async event - single async listener | 387 ns | 2.6M ops/s | no change |
| async event - 10 listeners | 1.2 µs | 829K ops/s | no change |
| data event - with payload | 467 ns | 2.1M ops/s | no change |
| sync event - pre-compiled dispatcher | 21 ns | 48.0M ops/s | no change |
| sync event - with propagation stop | 82 ns | 12.2M ops/s | no change |
| dispatcher creation + listener add | 431 ns | 2.3M ops/s | no change |
| route match - simple static | 155 ns | 6.4M ops/s | no change |
| route match - single param | 208 ns | 4.8M ops/s | no change |
| route match - multi param | 281 ns | 3.6M ops/s | no change |
| route match - with query | 1.1 µs | 879K ops/s | +136% |
| route match - many routes (first) | 69 ns | 14.5M ops/s | no change |
| route match - many routes (middle) | 135 ns | 7.4M ops/s | no change |
| route match - many routes (last) | 355 ns | 2.8M ops/s | no change |
| route match - not found | 209 ns | 4.8M ops/s | no change |
| resolve request - simple | 45 ns | 22.1M ops/s | no change |
| resolve request - with params | 189 ns | 5.3M ops/s | no change |
| resolve request - with query | 1.1 µs | 893K ops/s | +140% |
| serialize - single user | 1.7 µs | 605K ops/s | +30% |
| serialize - user array (10) | 16 µs | 61.9K ops/s | +544% |
| serialize - api response | 18 µs | 55.0K ops/s | +954% |
| JSON.stringify - single user | 3.0 µs | 337K ops/s | no change |
| JSON.stringify - user array (10) | 23 µs | 43.9K ops/s | no change |
| deserialize - single user | 463 ns | 2.2M ops/s | +97% |
| deserialize - user array (10) | 4.4 µs | 230K ops/s | +2451% |
| JSON.parse - single user | 789 ns | 1.3M ops/s | no change |
| create router registry | 11 ns | 88.2M ops/s | no change |
| registry - add GET route | 330 ns | 3.0M ops/s | no change |
| registry - add 5 routes | 1.4 µs | 727K ops/s | no change |
| resolveUrl - single param | 6.2 ns | 162M ops/s | no change |
| resolveUrl - multi param | 10 ns | 98.1M ops/s | no change |
| middleware config - create | 7.5 µs | 133K ops/s | no change |
| middleware config - with route filter | 15 µs | 67.4K ops/s | no change |
| read controller metadata | 41 ns | 24.6M ops/s | no change |
| get routes from router | 0.7 ns | 1357M ops/s | no change |
| GET with route parameter | 118 µs | 8.5K ops/s | no change |
| GET list of 10 with query parameter | 155 µs | 6.5K ops/s | no change |
| POST with validated JSON body | 225 µs | 4.5K ops/s | no change |
| validation error (400) | 112 µs | 8.9K ops/s | no change |
| not found (404) | 79 µs | 12.7K ops/s | no change |
| baseline: new Database() | 1.0 ns | 1003M ops/s | no change |
| get simple provider | 22 ns | 46.4M ops/s | no change |
| get provider with dependencies | 22 ns | 46.3M ops/s | no change |
| get via resolver function | 0.7 ns | 1361M ops/s | no change |
| scoped: same scope (cached) | 39 ns | 25.8M ops/s | no change |
| scoped: new scope each call | 55 ns | 18.3M ops/s | no change |
| context.getInjector().get() | 24 ns | 41.2M ops/s | no change |
| new InjectorContext(module) | 2.1 ns | 467M ops/s | no change |
| createChildScope() | 2.2 ns | 460M ops/s | no change |
| createChildScope().getInjector() | 14 ns | 69.1M ops/s | no change |
| 10 providers: get() | 9.7 ns | 104M ops/s | no change |
| 10 providers: resolver() | 0.7 ns | 1362M ops/s | no change |
| 50 providers: get() | 9.7 ns | 104M ops/s | no change |
| 50 providers: resolver() | 0.7 ns | 1339M ops/s | no change |
| 100 providers: get() | 9.7 ns | 104M ops/s | no change |
| 100 providers: resolver() | 0.7 ns | 1339M ops/s | no change |
| 200 providers: get() | 9.7 ns | 104M ops/s | no change |
| 200 providers: resolver() | 0.7 ns | 1339M ops/s | no change |
| 500 providers: get() | 9.6 ns | 104M ops/s | no change |
| 500 providers: resolver() | 0.7 ns | 1338M ops/s | no change |
| chain depth 1: get() | 9.7 ns | 104M ops/s | no change |
| chain depth 3: get() | 9.7 ns | 104M ops/s | no change |
| chain depth 5: get() | 9.7 ns | 104M ops/s | no change |
| chain depth 10: get() | 9.7 ns | 104M ops/s | no change |
| singleton: get() | 22 ns | 45.6M ops/s | no change |
| scoped: same scope get() | 43 ns | 23.3M ops/s | no change |
| scoped: new scope + get() | 142 ns | 7.0M ops/s | no change |
| tag injection: get service with tags | 9.7 ns | 104M ops/s | no change |
| transient: get() (new instance) | 59 ns | 17.1M ops/s | no change |
| non-transient: get() (cached) | 22 ns | 46.4M ops/s | no change |
| resolver caching: direct get() | 9.7 ns | 104M ops/s | no change |
| resolver caching: cached resolver() | 0.7 ns | 1353M ops/s | no change |
| resolver caching: context.resolve() | 0.7 ns | 1361M ops/s | no change |
| injector creation: 10 providers | 147 µs | 6.8K ops/s | no change |
| injector creation: 100 providers | 7.6 ms | 131 ops/s | no change |
| injector creation: 500 providers | 83 ms | 12.0 ops/s | +81% |
| log info - no formatter | 249 ns | 4.0M ops/s | no change |
| log info - default formatter | 2.8 µs | 356K ops/s | no change |
| log info - color formatter | 1.4 µs | 703K ops/s | no change |
| log debug level | 262 ns | 3.8M ops/s | +12% |
| log warning level | 261 ns | 3.8M ops/s | +10% |
| log error level | 263 ns | 3.8M ops/s | +9% |
| log info - disabled (filtered) | 26 ns | 38.5M ops/s | no change |
| scoped logger - info | 1.5 µs | 656K ops/s | no change |
| scoped logger creation (cached) | 0.7 ns | 1362M ops/s | no change |
| log with format args | 712 ns | 1.4M ops/s | no change |
| log with data | 387 ns | 2.6M ops/s | +6% |
| memory logger - info | 609 ns | 1.6M ops/s | no change |
| log info - 3 transports | 509 ns | 2.0M ops/s | no change |
| logger.is() check | 5.2 ns | 194M ops/s | no change |
| convert filter (no database) | 1.6 µs | 620K ops/s | no change |
| findOne by _id | 360 µs | 2.8K ops/s | no change |
| find 100 with hydration | 1.2 ms | 814 ops/s | no change |
| find 100 without hydration (lean) | 1.2 ms | 838 ops/s | no change |
| count with filter | 849 µs | 1.2K ops/s | no change |
| insert one | 313 µs | 3.2K ops/s | no change |
| insert 100 in one session | 2.1 ms | 473 ops/s | no change |
| patchOne | 400 µs | 2.5K ops/s | no change |
| change detection + update of a loaded entity | 864 µs | 1.2K ops/s | no change |
| simple: ping (no args, string return) | 10 µs | 95.4K ops/s | no change |
| simple: echo (string arg, string return) | 10 µs | 98.5K ops/s | no change |
| simple: add (2 number args, number return) | 9.2 µs | 109K ops/s | no change |
| simple: validateNumber (with validation) | 10 µs | 96.5K ops/s | no change |
| user: getUser (entity return) | 16 µs | 61.6K ops/s | no change |
| user: createUser (2 string args, entity return) | 17 µs | 57.5K ops/s | no change |
| product: getProduct (entity return) | 21 µs | 47.7K ops/s | no change |
| product: createProduct (complex args, entity return) | 21 µs | 48.6K ops/s | no change |
| user: listUsers (complex result with array) | 39 µs | 25.9K ops/s | no change |
| product: search (object args, array return) | 45 µs | 22.0K ops/s | no change |
| user: processUsers (2 items) | 19 µs | 51.5K ops/s | no change |
| user: processUsers (10 items) | 37 µs | 26.9K ops/s | no change |
| user: processUsers (100 items) | 217 µs | 4.6K ops/s | no change |
| product: bulkCreate (2 items) | 22 µs | 44.9K ops/s | no change |
| product: bulkCreate (10 items) | 44 µs | 22.9K ops/s | no change |
| type cache: first call (cold) | 694 µs | 1.4K ops/s | no change |
| type cache: subsequent calls (warm) | 10 µs | 96.3K ops/s | no change |
| sequential: 5 simple calls | 49 µs | 20.6K ops/s | no change |
| sequential: 5 entity calls | 85 µs | 11.8K ops/s | no change |
| connect + call + disconnect | 479 µs | 2.1K ops/s | no change |
| createRpcMessage (no body) | 5.9 ns | 170M ops/s | -14% |
| createRpcMessage small body | 9.8 ns | 102M ops/s | +2206% |
| createRpcMessage medium body | 9.7 ns | 103M ops/s | +3192% |
| createRpcMessage large body | 9.7 ns | 103M ops/s | +2173% |
| serialize (no body) | 89 ns | 11.2M ops/s | -25% |
| serialize small body | 396 ns | 2.5M ops/s | no change |
| serialize medium body | 2.0 µs | 488K ops/s | no change |
| serialize large body | 236 µs | 4.2K ops/s | no change |
| deserialize (no body) | 137 ns | 7.3M ops/s | no change |
| deserialize small (header only) | 142 ns | 7.1M ops/s | no change |
| deserialize medium (header only) | 141 ns | 7.1M ops/s | no change |
| deserialize large (header only) | 140 ns | 7.1M ops/s | no change |
| parseBody small | 239 ns | 4.2M ops/s | +106% |
| parseBody medium | 2.1 µs | 470K ops/s | +25% |
| parseBody large | 291 µs | 3.4K ops/s | no change |
| decodeBody small (cached decoder) | 156 ns | 6.4M ops/s | no change |
| decodeBody medium (cached decoder) | 2.0 µs | 503K ops/s | no change |
| decodeBody large (cached decoder) | 297 µs | 3.4K ops/s | no change |
| round-trip small | 1.0 µs | 977K ops/s | no change |
| round-trip medium | 5.1 µs | 198K ops/s | no change |
| create + serialize sourceDest message | 573 ns | 1.7M ops/s | +60% |
| deserialize + parse sourceDest message | 469 ns | 2.1M ops/s | +50% |
| serialize composite message | 1.2 µs | 856K ops/s | no change |
| deserialize + getBodies composite | 338 ns | 3.0M ops/s | no change |
| deserialize + getBodies + parseBody composite | 998 ns | 1.0M ops/s | +50% |
| serialize RpcTypes.Ack | 104 ns | 9.6M ops/s | -36% |
| serialize RpcTypes.Ping | 95 ns | 10.5M ops/s | -29% |
| serialize RpcTypes.Action | 1.1 µs | 943K ops/s | no change |
| serialize RpcTypes.ResponseActionSimple | 1.2 µs | 828K ops/s | no change |
| deserialize single entity | 798 ns | 1.3M ops/s | +75% |
| deserialize 100 entities | 79 µs | 12.6K ops/s | +73% |
| cast single entity | 1.2 µs | 829K ops/s | +81% |
| serialize single entity | 2.1 µs | 478K ops/s | +26% |
| create query | 1.4 µs | 724K ops/s | no change |
| query with filter | 2.7 µs | 365K ops/s | no change |
| query with multiple filters | 8.0 µs | 125K ops/s | no change |
| query with select | 4.4 µs | 229K ops/s | no change |
| clone query | 1.4 µs | 730K ops/s | no change |
| create session | 201 ns | 5.0M ops/s | no change |
| session add item | 893 ns | 1.1M ops/s | no change |
| session add 10 items | 5.7 µs | 174K ops/s | no change |
| query count | 17 µs | 59.3K ops/s | no change |
| query findOne | 65 µs | 15.5K ops/s | no change |
| query find (limit 10) | 92 µs | 10.9K ops/s | no change |
| query find with filter | 107 µs | 9.3K ops/s | no change |
| insert single item | 68 µs | 14.6K ops/s | no change |
| patch single item | 228 µs | 4.4K ops/s | no change |
| createSnapshot (small entity) | 8.4 ns | 119M ops/s | no change |
| createSnapshot (medium entity) | 3.6 µs | 279K ops/s | no change |
| createSnapshot (large entity) | 6.0 µs | 168K ops/s | no change |
| detect changes (no changes, small) | 35 ns | 28.7M ops/s | no change |
| detect changes (no changes, medium) | 314 ns | 3.2M ops/s | no change |
| detect changes (no changes, large) | 932 ns | 1.1M ops/s | no change |
| detect changes (with changes, small) | 174 ns | 5.8M ops/s | no change |
| detect changes (with changes, medium) | 542 ns | 1.8M ops/s | no change |
| detect changes (with changes, large) | 1.6 µs | 640K ops/s | no change |
| extract primary key (small) | 1.6 ns | 630M ops/s | no change |
| extract primary key (medium) | 1.7 ns | 593M ops/s | no change |
| extract primary key (large) | 29 ns | 34.9M ops/s | no change |
| generate PK hash (small) | 5.0 ns | 198M ops/s | no change |
| generate PK hash (medium) | 5.1 ns | 197M ops/s | no change |
| generate PK hash (large) | 28 ns | 36.0M ops/s | no change |
| buildChanges (no changes, small) | 213 ns | 4.7M ops/s | no change |
| buildChanges (no changes, medium) | 4.2 µs | 238K ops/s | no change |
| buildChanges (no changes, large) | 7.8 µs | 128K ops/s | no change |
| buildChanges (with changes, small) | 274 ns | 3.6M ops/s | no change |
| buildChanges (with changes, medium) | 4.4 µs | 227K ops/s | no change |
| buildChanges (with changes, large) | 8.3 µs | 121K ops/s | no change |
| ReflectionClass.from (cached) | 74 ns | 13.6M ops/s | no change |
| typeOf<string> | 773 ns | 1.3M ops/s | no change |
| typeOf<number> | 805 ns | 1.2M ops/s | no change |
| typeOf<User> | 289 ns | 3.5M ops/s | +115% |
| typeOf<Product> | 7.7 ns | 129M ops/s | +2599% |
| typeOf<Order> | 18 ns | 54.5M ops/s | +1075% |
| typeOf<PaymentMethod> | 18 ns | 54.4M ops/s | +1048% |
| typeOf<User[]> | 2.0 µs | 510K ops/s | no change |
| typeOf<Map<string, User>> | 2.2 µs | 446K ops/s | no change |
| reflect(User) | 187 ns | 5.3M ops/s | no change |
| reflect(function) | 186 ns | 5.4M ops/s | no change |
| resolveReceiveType<string> | 15 ns | 65.5M ops/s | +5986% |
| resolveReceiveType<User> | 305 ns | 3.3M ops/s | +113% |
| getProperties() | 0.7 ns | 1347M ops/s | no change |
| getPropertyNames() | 0.7 ns | 1357M ops/s | no change |
| getProperty(name) | 21 ns | 47.9M ops/s | no change |
| hasProperty(name) | 25 ns | 39.7M ops/s | no change |
| iterate all properties | 43 ns | 23.0M ops/s | no change |
| getMethods() | 0.7 ns | 1357M ops/s | no change |
| getMethodNames() | 0.7 ns | 1357M ops/s | no change |
| getMethod(name) | 16 ns | 62.7M ops/s | no change |
| hasMethod(name) | 21 ns | 47.3M ops/s | no change |
| method.getParameters() | 24 ns | 41.8M ops/s | no change |
| type.kind === ReflectionKind.string | 3.4 ns | 297M ops/s | no change |
| type.kind === ReflectionKind.class | 3.4 ns | 297M ops/s | no change |
| type.kind === ReflectionKind.union | 3.4 ns | 298M ops/s | no change |
| type.kind === ReflectionKind.array | 3.4 ns | 297M ops/s | no change |
| property.isOptional() | 0.7 ns | 1357M ops/s | no change |
| property.getType() | 0.7 ns | 1356M ops/s | no change |
| property.isArray() | 3.4 ns | 297M ops/s | no change |
| property.getKind() | 0.9 ns | 1056M ops/s | no change |
| ReflectionFunction.from(fn) | 293 ns | 3.4M ops/s | no change |
| function.getParameters() | 0.7 ns | 1351M ops/s | no change |
| function.getReturnType() | 0.7 ns | 1357M ops/s | no change |
| reflection.getClassName() | 4.2 ns | 238M ops/s | no change |
| reflection.getClassType() | 3.8 ns | 265M ops/s | no change |
| reflection.getConstructorOrUndefined() | 9.7 ns | 104M ops/s | no change |
| deepkit small deserialize | 523 ns | 1.9M ops/s | +97% |
| deepkit small serialize | 522 ns | 1.9M ops/s | +98% |
| deepkit medium deserialize | 1.1 µs | 903K ops/s | no change |
| deepkit medium serialize | 2.6 µs | 381K ops/s | +20% |
| deepkit large deserialize | 5.5 µs | 182K ops/s | no change |
| deepkit large serialize | 14 µs | 74.0K ops/s | no change |
| deepkit array[100] deserialize | 9.0 µs | 111K ops/s | +1480% |
| deepkit array[100] serialize | 9.3 µs | 108K ops/s | +1075% |
| deepkit array[1000] deserialize | 95 µs | 10.6K ops/s | +187% |
| deepkit array[1000] serialize | 96 µs | 10.4K ops/s | +168% |
| deepkit array[10000] deserialize | 2.0 ms | 500 ops/s | no change |
| deepkit array[10000] serialize | 1.1 ms | 918 ops/s | +53% |
| deepkit deeply-nested deserialize | 1.0 µs | 964K ops/s | +52% |
| deepkit deeply-nested serialize | 2.2 µs | 457K ops/s | +30% |
| deepkit union-types deserialize | 1.2 µs | 832K ops/s | +56% |
| deepkit union-types serialize | 1.3 µs | 749K ops/s | no change |
| deepkit special-types deserialize | 4.0 µs | 251K ops/s | no change |
| deepkit special-types serialize | 9.2 µs | 109K ops/s | no change |
| deepkit tree-structure deserialize | 1.3 µs | 771K ops/s | +61% |
| deepkit tree-structure serialize | 1.3 µs | 750K ops/s | +54% |
| deepkit linked-list deserialize | 723 ns | 1.4M ops/s | +85% |
| deepkit linked-list serialize | 679 ns | 1.5M ops/s | +83% |
| deepkit category-hierarchy deserialize | 1.2 µs | 815K ops/s | +58% |
| deepkit category-hierarchy serialize | 1.3 µs | 797K ops/s | no change |
| guard union (rotating members) | 51 ns | 19.5M ops/s | +719% |
| guard union text only | 44 ns | 22.7M ops/s | no change |
| deserialize union | 284 ns | 3.5M ops/s | no change |
| guard (valid) | 35 ns | 28.5M ops/s | +116% |
| guard (invalid) | 40 ns | 24.8M ops/s | +301% |
| validate (valid) | 38 ns | 26.2M ops/s | +92% |
| validate (invalid) | 141 ns | 7.1M ops/s | no change |
| is (valid, no errors) | 61 ns | 16.3M ops/s | +502% |
| is (invalid, no errors) | 71 ns | 14.1M ops/s | +626% |
| is (valid, with errors) | 73 ns | 13.8M ops/s | +448% |
| is (invalid, with errors) | 152 ns | 6.6M ops/s | +338% |
| assert (valid) | 85 ns | 11.8M ops/s | +355% |
| assert (invalid, try-catch) | 7.1 µs | 142K ops/s | no change |
| constraints (valid) | 236 ns | 4.2M ops/s | +14% |
| constraints (invalid) | 395 ns | 2.5M ops/s | +93% |
| constraints validate (invalid) | 818 ns | 1.2M ops/s | no change |
| array objects (valid) | 119 ns | 8.4M ops/s | +127% |
| array objects (invalid) | 330 ns | 3.0M ops/s | +407% |
| array objects validate (invalid) | 1.6 µs | 623K ops/s | no change |
| large array (100 items) | 3.2 µs | 308K ops/s | +99% |
| deep nested (valid) | 719 ns | 1.4M ops/s | +68% |
| deep nested (invalid) | 931 ns | 1.1M ops/s | +265% |
| deep nested validate (invalid) | 2.9 µs | 346K ops/s | no change |
| union text (valid) | 25 ns | 39.5M ops/s | +81% |
| union image (valid) | 31 ns | 32.8M ops/s | +639% |
| union video (valid) | 32 ns | 31.7M ops/s | +1376% |
| union file (valid) | 33 ns | 30.5M ops/s | +2276% |
| union text (invalid) | 116 ns | 8.6M ops/s | +1142% |
| union image (invalid) | 124 ns | 8.1M ops/s | +795% |
| union validate (invalid) | 643 ns | 1.6M ops/s | +124% |
| overhead: guard (valid) | 35 ns | 28.3M ops/s | +107% |
| overhead: validate (valid) | 42 ns | 23.9M ops/s | no change |
| overhead: guard (invalid) | 45 ns | 22.3M ops/s | +290% |
| overhead: validate (invalid) | 128 ns | 7.8M ops/s | no change |
| overhead: guard (many errors) | 371 ns | 2.7M ops/s | +102% |
| overhead: validate (many errors) | 869 ns | 1.2M ops/s | no change |
The benchmarks are in benchmarks/ of each package and in benchmarks/comparison. The results are written to benchmarks/results/<machine>; the ones of this page are committed in the repository.
git clone https://github.com/deepkit/deepkit-framework.git cd deepkit-framework yarn && npm run postinstall && npm run tsc npm run bench # all benchmarks npm run bench -- type bson # files whose path contains type or bson npm run bench -- --target 1.0.19 # the same benchmarks against a published version