3 ms·
> You can't get better performance or smaller size than a manual written js solution. Except in cases where the handwritten solution must be transformed to a d
by isoos 10y ago
> You can't get better performance or smaller size than a manual written js solution.
Except in cases where the handwritten solution must be transformed to a different pattern (doing essentially the same thing). For example, the handwritten solution may write:
element.innterHTML = '<div><span>x</span></div>';
While the compiler will unpack that and would use document.createElement() and would append these nodes together. The example may be lame, but most people would prefer a short string over 4+ lines of createElement() calls in their handwritten version. (Same old story with assembly vs. compiled C code).
Similar pattern may arise for various parts of the JS execution profiles and/or browser runtime quirks.