{"id":13485045,"url":"https://github.com/moltar/typescript-runtime-type-benchmarks","last_synced_at":"2025-03-27T17:30:46.791Z","repository":{"id":36649471,"uuid":"210419229","full_name":"moltar/typescript-runtime-type-benchmarks","owner":"moltar","description":"📊 Benchmark Comparison of Packages with Runtime Validation and TypeScript Support","archived":false,"fork":false,"pushed_at":"2025-03-24T16:05:29.000Z","size":22744,"stargazers_count":720,"open_issues_count":38,"forks_count":77,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-24T19:46:53.874Z","etag":null,"topics":["benchmark","benchmarks","decoders","json","runtypes","types","typescript","typescript-support","validation","validation-library"],"latest_commit_sha":null,"homepage":"https://moltar.github.io/typescript-runtime-type-benchmarks/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moltar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-23T17:58:38.000Z","updated_at":"2025-03-24T12:56:17.000Z","dependencies_parsed_at":"2023-10-03T04:32:14.137Z","dependency_job_id":"e8b85bf5-7aa2-4530-a80a-8ddd4704a0ad","html_url":"https://github.com/moltar/typescript-runtime-type-benchmarks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moltar%2Ftypescript-runtime-type-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moltar%2Ftypescript-runtime-type-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moltar%2Ftypescript-runtime-type-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moltar%2Ftypescript-runtime-type-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moltar","download_url":"https://codeload.github.com/moltar/typescript-runtime-type-benchmarks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245892459,"owners_count":20689506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","benchmarks","decoders","json","runtypes","types","typescript","typescript-support","validation","validation-library"],"created_at":"2024-07-31T17:01:43.819Z","updated_at":"2025-03-27T17:30:46.785Z","avatar_url":"https://github.com/moltar.png","language":"TypeScript","readme":"# 📊 Benchmark Comparison of Packages with Runtime Validation and TypeScript Support\n\n- - - -\n**⚡⚠ Benchmark results have changed after switching to isolated node processes for each benchmarked package, see [#864](https://github.com/moltar/typescript-runtime-type-benchmarks/issues/864) ⚠⚡**\n- - - -\n\n## Benchmark Results\n\n[![Fastest Packages - click to view details](docs/results/preview.svg)](https://moltar.github.io/typescript-runtime-type-benchmarks)\n\n[click here for result details](https://moltar.github.io/typescript-runtime-type-benchmarks)\n\n## Packages Compared\n\n* [aeria](https://github.com/aeria-org/aeria)\n* [ajv](https://ajv.js.org/)\n* [ArkType](https://github.com/arktypeio/arktype)\n* [banditypes](https://github.com/thoughtspile/banditypes)\n* [bueno](https://github.com/philipnilsson/bueno)\n* [caketype](https://github.com/justinyaodu/caketype)\n* [class-validator](https://github.com/typestack/class-validator) + [class-transformer](https://github.com/typestack/class-transformer)\n* [cleaners](https://cleaners.js.org)\n* [computed-types](https://github.com/neuledge/computed-types)\n* [decoders](https://github.com/nvie/decoders)\n* [deepkit](https://deepkit.io/)\n* [@effect/schema](https://github.com/Effect-TS/effect/blob/main/packages/schema/README.md)\n* [io-ts](https://github.com/gcanti/io-ts)\n* [jet-validators](https://github.com/seanpmaxwell/jet-validators)\n* [joi] (https://github.com/hapijs/joi)\n* [jointz](https://github.com/moodysalem/jointz)\n* [json-decoder](https://github.com/venil7/json-decoder)\n* [@mojotech/json-type-validaton](https://github.com/mojotech/json-type-validation)\n* [$mol_data](https://github.com/hyoo-ru/mam_mol/blob/master/data/README.md)\n* [@mondrian-framework/model](https://mondrianframework.com)\n* [myzod](https://github.com/davidmdm/myzod)\n* [ok-computer](https://github.com/richardscarrott/ok-computer)\n* [pure-parse](https://github.com/johannes-lindgren/pure-parse)\n* [purify-ts](https://github.com/gigobyte/purify)\n* [parse-dont-validate](https://github.com/Packer-Man/parse-dont-validate)\n* [Paseri](https://github.com/vbudovski/paseri)\n* [r-assign](https://github.com/micnic/r-assign)\n* [rescript-schema](https://github.com/DZakh/rescript-schema)\n* [rulr](https://github.com/ryansmith94/rulr)\n* [runtypes](https://github.com/pelotom/runtypes)\n* [@sapphire/shapeshift](https://github.com/sapphiredev/shapeshift)\n* [@sinclair/typebox](https://github.com/sinclairzx81/typebox)\n* [@sinclair/typemap](https://github.com/sinclairzx81/typemap)\n* [simple-runtypes](https://github.com/hoeck/simple-runtypes)\n* [spectypes](https://github.com/iyegoroff/spectypes)\n* [stnl](https://github.com/re-utils/stnl)\n* [succulent](https://github.com/aslilac/succulent)\n* [superstruct](https://github.com/ianstormtaylor/superstruct)\n* [suretype](https://github.com/grantila/suretype)\n* [tiny-schema-validator](https://github.com/5alidz/tiny-schema-validator)\n* [to-typed](https://github.com/jsoldi/to-typed)\n* [toi](https://github.com/hf/toi)\n* [ts-auto-guard](https://github.com/rhys-vdw/ts-auto-guard)\n* [ts-interface-checker](https://github.com/gristlabs/ts-interface-checker)\n* [ts-json-validator](https://github.com/ostrowr/ts-json-validator)\n* [ts-runtime-checks](https://github.com/GoogleFeud/ts-runtime-checks)\n* [tson](https://github.com/skarab42/tson)\n* [ts-utils](https://github.com/ai-labs-team/ts-utils)\n* [type-predicate-generator](https://github.com/peter-leonov/typescript-predicate-generator)\n* [typia](https://github.com/samchon/typia)\n* [@typeofweb/schema](https://github.com/typeofweb/schema)\n* [unknownutil](https://github.com/lambdalisue/deno-unknownutil)\n* [valibot](https://github.com/fabian-hiller/valibot)\n* [valita](https://github.com/badrap/valita)\n* [Vality](https://github.com/jeengbe/vality)\n* [yup](https://github.com/jquense/yup)\n* [zod](https://github.com/vriad/zod)\n\n## Criteria\n\n### Validation\n\nThese packages are capable of validating the data for type correctness.\n\nE.g. if `string` was expected, but a `number` was provided, the validator should fail.\n\n### Interface\n\nIt has a validator function or method that returns a valid type casted value or throws.\n\n```ts\nconst data: any = {}\n\n// `res` is now type casted to the right type\nconst res = isValid(data)\n```\n\nOr it has a type guard function that in a truthy block type casts the value.\n\n```ts\nconst data: any = {}\n\nfunction isMyDataValid(data: any) {\n  // isValidGuard is the type guard function provided by the package\n  if (isValidGuard(data)) {\n    // data here is \"guarded\" and therefore inferred to be of the right type\n    return data\n  }\n\n  throw new Error('Invalid!')\n}\n\n// `res` is now type casted to the right type\nconst res = isMyDataValid(data)\n```\n\n## Local Development\n\n### Commands\n\n#### Benchmarks\n\n* `npm run start` - run benchmarks for all modules using Node.js\n* `npm run start:bun` - run benchmarks for all modules using bun\n* `npm run start run zod myzod valita` - run benchmarks only for a few selected modules\n\n#### Tests\n\n* `npm run test` - run build process and tests for all modules\n* `npm run test:build` - run build process for all modules\n\n#### Docs\n\n* `npm run docs:serve` - result viewer\n* `npm run docs:build` - build docs\n* `npm run docs:watch` - watch docs for changes and rebuild\n\n#### Linting\n\n* `npm run lint` - lint all files\n* `npm run lint:fix` - lint all files and fix errors\n\n#### Misc\n\n* `npm run download-packages-popularity` - download popularity data from npmjs.com\n\n### Debugging\n\n#### Node.js\n\n* Use [nvm](https://github.com/nvm-sh/nvm) to switch to a specific Node.js version\n* `nvm use x` - switch to Node.js x.x\n* `nvm use 18` - switch to Node.js 18.x\n* `nvm use 20` - switch to Node.js 20.x\n\n#### Bun\n\n* Use `curl -fsSl https://bun.sh/install | bash -s \"bun-v1.0.x\"` to switch to a specific bun version\n* `curl -fsSl https://bun.sh/install | bash -s \"bun-v1.1.43\"` - switch to bun 1.1.43\n\n#### Deno\n\n* Use `deno upgrade x.x.x` to switch to a specific Deno version\n* `deno upgrade stable` - switch to Deno x.x.x\n\n## Adding new runtime version\n\n### Node.js runtime\n\n* update Node.js version matrix in `.github/workflows/pr.yml` and `.github/workflows/release.yml`\n* update `NODE_VERSIONS` in `docs/dist/app.tsx` and run `npm run docs:build`\n* optionally set `NODE_VERSION_FOR_PREVIEW` in `benchmarks/helpers/main.ts`\n\n### Bun runtime\n\n* update bun version matrix in `.github/workflows/pr.yml` and `.github/workflows/release.yml`\n* update `BUN_VERSIONS` in `docs/dist/app.tsx` and run `npm run docs:build`\n\n### Deno runtime\n\n* update Deno version matrix in `.github/workflows/pr.yml` and `.github/workflows/release.yml`\n* update `DENO_VERSIONS` in `docs/dist/app.tsx` and run `npm run docs:build`\n\n## Test cases\n\n* **Safe Parsing**\n  * Checks the input object against a schema and returns it.\n  * Raises an error if the input object does not conform to the schema (e.g., a type mismatch or missing attribute).\n  * Removes any extra keys in the input object that are not defined in the schema.\n\n* **Strict Parsing**\n  * Checks the input object against a schema and returns it.\n  * Raises an error if the input object does not conform to the schema (e.g., a type mismatch or missing attribute).\n  * Raises an error if the input object contains extra keys.\n\n* **Loose Assertion**\n  * Checks the input object against a schema.\n  * Raises an exception if the input object does not match the schema.\n  * Allows extra keys without raising errors.\n  * Returns true if data is valid.\n\n* **Strict Assertion**\n  * Checks the input object against a schema.\n  * Raises an exception if the input object does not match the schema.\n  * Raises an error if the input object or any nested input objects contain extra keys.\n  * Returns true if data is valid.\n\n## Contributors\n\n\u003ca href=\"https://github.com/moltar/typescript-runtime-type-benchmarks/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=moltar/typescript-runtime-type-benchmarks\" /\u003e\n\u003c/a\u003e\n","funding_links":[],"categories":["TypeScript","Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoltar%2Ftypescript-runtime-type-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoltar%2Ftypescript-runtime-type-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoltar%2Ftypescript-runtime-type-benchmarks/lists"}