Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specialized matrix transform for Vector3 and Matrix3x3 #585

Merged
merged 5 commits into from
Aug 23, 2024

Commits on Aug 13, 2024

  1. 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
    lloydk committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    f6b705c View commit details
    Browse the repository at this point in the history
  2. Fix formatting

    lloydk committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    df99aae View commit details
    Browse the repository at this point in the history
  3. Fix type test

    lloydk committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    2930052 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2024

  1. Configuration menu
    Copy the full SHA
    6f8f745 View commit details
    Browse the repository at this point in the history
  2. Fix tests

    lloydk committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    8e39fdf View commit details
    Browse the repository at this point in the history