dillon1000/react
Commit
Browse files Put common aliases in Map/Set instead of switch over strings (#26551)
This is a follow up to https://github.com/facebook/react/pull/26546 This is strictly a perf optimization since we know that switches over strings aren't optimally implemented in current engines. Basically they're a sequence of ifs. As a result, we're better off putting the unusual cases in a Map and the very common cases in the beginning of the switch. We might be better off putting very common cases in explicit ifs - just in case the engine does optimize switches to a hash table which is potentially worse. --------- Co-authored-by: Sophie Alpert <[email protected]>
Changed paths5 files
First-parent comparisonpackages/react-dom-bindings/src/client/DOMPropertyOperations.js ModifiedM packages/react-dom-bindings/src/client/ReactDOMComponent.js ModifiedM packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js ModifiedA packages/react-dom-bindings/src/shared/getAttributeAlias.js AddedM packages/react-dom-bindings/src/shared/isUnitlessNumber.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…