I get the feeling this is an AI hallucination. It uses the canvas to render the text to be measured, which doesn't bypass the browser layouting. The only potential performance to be gained here is rendering straight to a canvas instead of building a dom node, but it's not clear that it's actually faster. I can't imagine the cost of a single is that large, and I'm not certain that it's slower than whatever steps the c…
If you only perform layout once, it doesn't save any work. If you need to reflow many times, it saves a lot.