mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-24 16:09:32 -06:00
* perf: improve performance of `experimentalSourceRewriting` This change is in addition to https://github.com/benjamn/recast/pull/1399. This commit focuses on Cypress' use of recast, with the following optimizations: 1. Avoid printing the source file again if no change was made. Printing an AST using recast does reuse the original text, but identifying for which parts of the AST reuse is possible comes with noticeable overhead. By tracking changes within the visitor it becomes possible to skip this phase entirely if no changes were made. 2. Avoid a scope lookup (`path.scope.declares(node.name)`) for all identifiers in the program, doing it only for identifiers that may have to be rewritten. With these changes, a 2.6MB bundle that does not need rewriting has improved from 4.4s to 2.3s, provided that the above-mentioned recast PR has been applied. * chore: move `experimentalSourceRewriting` release note to pending release section --------- Co-authored-by: Bill Glesias <bglesias@gmail.com> Co-authored-by: Jennifer Shehane <jennifer@cypress.io>