<commit_before>---
title: Performance
---

These tricks will make ts-node faster.

## Skip typechecking

It is often better to typecheck as part of your tests or linting.  You can use `tsc --noEmit` to do this.  In these cases, ts-node can skip typechecking making it much faster.

To skip typechecking in ts-node, do one of the following:

* Enable [swc](./swc.md)
  * This is by far the fastest option
* Enable [`transpileOnly`](./options.md#transpileonly) to skip typechecking without swc

## With typechecking

If you absolutely must use ts-node for typechecking:

* Avoid dynamic `require()` which may trigger repeated typechecking; prefer `import`
* Try with and without `--files`; one may be faster depending on your project
* Check `tsc --showConfig`; make sure all executed files are included
* Enable [`skipLibCheck`](https://www.typescriptlang.org/tsconfig#skipLibCheck)
* Set a [`types`](https://www.typescriptlang.org/tsconfig#types) array to avoid loading unnecessary `@types`
<commit_msg>docs tweak ugh<commit_after>---
title: Performance
---

These tricks will make ts-node faster.

## Skip typechecking

It is often better to typecheck as part of your tests or linting.  You can run `tsc --noEmit` to do this.  In these cases, ts-node can skip typechecking, making it much faster.

To skip typechecking in ts-node, do one of the following:

* Enable [swc](./swc.md)
  * This is by far the fastest option
* Enable [`transpileOnly`](./options.md#transpileonly) to skip typechecking without swc

## With typechecking

If you absolutely must typecheck in ts-node:

* Avoid dynamic `require()` which may trigger repeated typechecking; prefer `import`
* Try with and without `--files`; one may be faster depending on your project
* Check `tsc --showConfig`; make sure all executed files are included
* Enable [`skipLibCheck`](https://www.typescriptlang.org/tsconfig#skipLibCheck)
* Set a [`types`](https://www.typescriptlang.org/tsconfig#types) array to avoid loading unnecessary `@types`

{'fraction_non_alphanumeric': 0.1015, 'fraction_numerical': 0.0, 'mean_word_length': 4.467213114754099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '637016', 'n_tokens_mistral': 592, 'n_tokens_neox': 573, 'n_words': 247}