measureText performs a style re-calc and only performs layout (for container queries) if the style resolver requires it. In most cases, it won’t.
also, for a detached canvas, measureText goes straight to shaping and metrics since it is completely detached from the document’s style and layout system.
@birch_js Right, getBoundingClientRect will force a layout _if_ layout is stale. Otherwise it won't. But, measureText is performing layout work too, that's how it works.
The key is to avoid interleaving layout reads & writes, or isolate their impact.
@kettanaito its same as constructing a new Promise and resolving it within the ctor body. i.e a Promise ctor doesn’t schedule callbacks to the microtask and will execute it right away.
@__nmca__ …i think it’s a VM written in python with all kinds of parallelism, a custom instruction set, and they ask you to do bunch of optimizations on various levels.