-
-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add a type-checking fast path for primitive types (#755)
When `Draft<T>` is applied to a large enum type, TypeScript has to do a lot of unnecessary structural comparisons to confirm that no element of the enum matches `Function`, `Date`, `RegExp`, etc. Determining that they do match `string` or `number`, on the other hand, is trivial. This change splits `PrimitiveType` out of `AtomicObject` so that the fast path can be checked first. In microsoft/TypeScript#42824, this cut the check time from ~2.5 seconds to ~0.3 seconds.
- Loading branch information
Showing
2 changed files
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters