-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specialized matrix transform for Vector3 and Matrix3x3 (#585)
* Add specialized matrix transform for Vector3 and Matrix3x3 Adds a specialized matrix multiplication function that transforms an array of length 3 with a 3x3 matrix. The specialized function can also transform the array in place which can eliminate one array allocation. The https://github.com/texel-org/color color library has a benchmark comparing itself to Color.js. Profiling the conversion benchmark showed that matrix multiplication was one of the areas that was taking the most amount of time. This PR speeds up the conversion benchmark by more than 3x and some of the other benchmarks by 2-3x Benchmark numbers before this PR: --------------------------------- conversion (Colorjs.io procedural API) -- Colorjs.io: 6213.74 ms Ours: 733.75 ms Speedup: 8.5x faster conversion (Colorjs.io main API) -- Colorjs.io: 25444.47 ms Ours: 703.50 ms Speedup: 36.2x faster gamut mapping OKLCH - sRGB (Colorjs.io procedural API) -- Colorjs.io: 13302.80 ms Ours: 72.97 ms Speedup: 182.3x faster gamut mapping OKLCH - sRGB (Colorjs.io main API) -- Colorjs.io: 14900.11 ms Ours: 67.78 ms Speedup: 219.8x faster gamut mapping all spaces to P3 (Colorjs.io procedural API) -- Colorjs.io: 10878.26 ms Ours: 201.85 ms Speedup: 53.9x faster gamut mapping all spaces to P3 (Colorjs.io main API) -- Colorjs.io: 13731.21 ms Ours: 201.76 ms Speedup: 68.1x faster After this PR: -------------- conversion (Colorjs.io procedural API) -- Colorjs.io: 1793.97 ms Ours: 713.03 ms Speedup: 2.5x faster conversion (Colorjs.io main API) -- Colorjs.io: 19884.18 ms Ours: 704.59 ms Speedup: 28.2x faster gamut mapping OKLCH - sRGB (Colorjs.io procedural API) -- Colorjs.io: 4981.04 ms Ours: 74.01 ms Speedup: 67.3x faster gamut mapping OKLCH - sRGB (Colorjs.io main API) -- Colorjs.io: 6477.12 ms Ours: 68.02 ms Speedup: 95.2x faster gamut mapping all spaces to P3 (Colorjs.io procedural API) -- Colorjs.io: 4205.36 ms Ours: 202.27 ms Speedup: 20.8x faster gamut mapping all spaces to P3 (Colorjs.io main API) -- Colorjs.io: 6137.99 ms Ours: 199.91 ms Speedup: 30.7x faster * Fix formatting * Fix type test * Rename transform to multiply_v3_m3x3 * Fix tests
- Loading branch information
Showing
14 changed files
with
149 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters