Don't copy every label of a large record per JSX element
Why
JsxDOM.domProps has 591 optional fields. For every lowercase JSX element, jsx_props_of mapped all of them into a fresh array just to check whether the record compiles to an array, and typing a record literal built a 591 entry array and list to look for missing mandatory labels.
In OCaml 5, Array.map on more than 256 elements forces a minor collection, which stops every domain. On a 552 module React app this happened about 2,800 times per build, 87% of all minor collections, and was most of the extra CPU time a build spends on 7 domains compared to 1.
The label array is now checked in place, and the missing label search is skipped when every label is optional. Records with a required label, like most component props, take the old path. The output is unchanged.
Review
- Why does a 1 domain build barely change? Without other domains waiting at each forced collection, the copy costs about 55 us per element. The gain comes from the collections no longer stopping the other domains.