MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Geometry_interfaces
What specific section or headline is this issue about?
No response
What information was incorrect, unhelpful, or incomplete?
Geometry interfaces seem to be tens of times, sometimes hundreds of times, slower than doing them manually in JS code, and this slowness is consistent across all three major browser engines.
This is something probably worth warning developers about, as it may seem counterintuitive.
What did you expect to see?
A warning that API from Geometry interfaces may be significantly slower than writing the corresponding code manually in JS code directly, and developers should carefully evaluate whether the convenience is worth such heavy performance penalty.
Do you have any supporting links, references, or citations?
Here is a benchmark that compares the very basic transformPoint method that uses DOMMatrix vs. a manual implemented version.
On my machine,
- Firefox: manual version is ~40x faster
- Chrome: manual version is ~160x faster
- Safari: manual version is ~50x faster
This code has the construction of matrix and point in the preparation code to show just the transform itself. Moving those construction code into corresponding test cases will expand the gap even further.
Do you have anything more you want to share?
It was raised to me by @DarkMatterMatt in an internal change, and the benchmark above was modified from the initial benchmark he created.
MDN metadata
Page report details
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Geometry_interfaces
What specific section or headline is this issue about?
No response
What information was incorrect, unhelpful, or incomplete?
Geometry interfaces seem to be tens of times, sometimes hundreds of times, slower than doing them manually in JS code, and this slowness is consistent across all three major browser engines.
This is something probably worth warning developers about, as it may seem counterintuitive.
What did you expect to see?
A warning that API from Geometry interfaces may be significantly slower than writing the corresponding code manually in JS code directly, and developers should carefully evaluate whether the convenience is worth such heavy performance penalty.
Do you have any supporting links, references, or citations?
Here is a benchmark that compares the very basic
transformPointmethod that usesDOMMatrixvs. a manual implemented version.On my machine,
This code has the construction of matrix and point in the preparation code to show just the transform itself. Moving those construction code into corresponding test cases will expand the gap even further.
Do you have anything more you want to share?
It was raised to me by @DarkMatterMatt in an internal change, and the benchmark above was modified from the initial benchmark he created.
MDN metadata
Page report details
en-us/web/api/geometry_interfaces