Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(transformer): faster parsing JSX pragmas from comments (#6151)
Parse JSX pragmas faster by: 1. Finding patterns with byte-by-byte iteration, with fast path for ASCII. 2. Checking for the `@jsx` prefix first before parsing the rest of the pragma. These routines could be speeded up further by using unchecked slicing (unsafe code). But I've avoided that as the routines at present are quite complex, so hard to verify. The exception is `trim_end`, which is trivial to verify, so I have used unchecked slicing there. The perf gain here is only ~0.5%, but we should split these routines out into a separate common crate and further optimize them, so that they can be used elsewhere in the codebase where we do string operations, which are often quite expensive.
- Loading branch information