prettier
4748c18a - Optimize printer functions in src/language-js/print/*.js

Commit
161 days ago
Optimize printer functions in src/language-js/print/*.js Optimizations to frequently called printer functions: **literal.js:** - Prioritize common "Literal" case first before Babel-specific types - Cache node.type to avoid repeated property access - Use typeof checks to reduce branches for common number/string cases **member.js:** - Cache parent.type to avoid repeated access in multiple conditions - Reorder variable declarations for better cache locality **call-expression.js:** - Cache node.type at function start to avoid repeated property access - Reduces overhead in frequently executed type checks **object.js:** - Cache node.type and parent.type for multiple checks - Extract isObjectPattern boolean to avoid repeated type comparisons - Reduces branching in hot path for object literal printing These micro-optimizations reduce property access overhead and improve branch prediction in hot paths. All 506 related tests pass. Co-authored-by: fisker <172584+fisker@users.noreply.github.com>
Author
Parents
Loading