Re: [csswg-drafts] [css-typed-om] CSS Typed OM is no faster than using strings and style attribute, no incentive to switch to CSS Typed OM (#11567)

I think your benchmarks are measuring the wrong thing. Instead of measuring the performance of CSS Typed OM, they are constrained by style invalidation, animation performance, etc.

A better benchmark would be to test _only_ the CSS Typed OM part. For example:

```js
const px = new CSSUnitValue(100, 'px');
const double_px = px.mul(2);
```

```js
const NUMERIC_REGEXP = /[-]{0,1}[\d]*[.]{0,1}[\d]+/g;
const px = `100px`;
const value = px.match(NUMERIC_REGEXP)[0];
const double_px = `${value * 2}px`;
```

Running these against each other gives the following difference:

<img width="1160" alt="Image" src="https://github.com/user-attachments/assets/ca52bf35-4048-4ee1-b8ae-5d3f376722e2" />

While there is a difference in speed (in Chrome ~3x, in Safari ~2x), to me the main advantage CSS Typed OM brings is the ease of use it introduces.

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11567#issuecomment-2616737783 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 27 January 2025 19:42:25 UTC