Hypothesis
Thesis #54 (accepted) showed that caching node.raws in Stringifier methods gave a 5.2ms improvement. This follow-up thesis pushes further by inlining the rawValue() method call itself in the hottest paths.
rawValue(node, exp, str) (stringifier.js) checks node.raws[exp], then falls back to node[str]. For declarations, rawValue is called twice per node (for between and value). Each call involves: function call overhead, property lookup, conditional check, potential rawCache walk.
Inline the fast path directly in decl():
decl(node, semicolon) {
let raws = node.raws
let between = raws.between || ': ' // inline rawValue for 'between'/'colon'
let value = raws.value !== undefined ? raws.value.value : node.value // inline rawValue for 'value'
// ... rest of method
}
Similarly inline in rule() for selector rawValue.
Editable surface
- lib/stringifier.js — inline rawValue in decl() and rule() hot paths
What's different from prior work
Expected impact
METRIC_A improvement of 1-2ms. METRIC_B improvement of 2-4ms. Combined 2-4ms composite on top of #54's gains.
Hypothesis
Thesis #54 (accepted) showed that caching node.raws in Stringifier methods gave a 5.2ms improvement. This follow-up thesis pushes further by inlining the rawValue() method call itself in the hottest paths.
rawValue(node, exp, str) (stringifier.js) checks node.raws[exp], then falls back to node[str]. For declarations, rawValue is called twice per node (for between and value). Each call involves: function call overhead, property lookup, conditional check, potential rawCache walk.
Inline the fast path directly in decl():
Similarly inline in rule() for selector rawValue.
Editable surface
What's different from prior work
Expected impact
METRIC_A improvement of 1-2ms. METRIC_B improvement of 2-4ms. Combined 2-4ms composite on top of #54's gains.