Closed p01 closed 7 months ago
Hey thanks!
I don't think indexOf
will work as we are dealing with array equality:
[ [2, 255, 5] ].indexOf([ 2, 255, 5 ])
// -> -1
Second thing, I don't think "fill palette" is actually a hot code path (typically we are dealing with 256 colors or less) so I'm not sure it's worth optimizing at the expense of legibility/simplicity.
Did you manage to benchmark the others in Chrome? I think I tested inlining create_bin()
and IIRC it performs about the same or better, but I could be mistaken.
I ended up cherry-picking a couple of these patches into the latest build, you could resolve conflicts and we could see if there's anything else here that could be optimized. I also didn't see much of a change in benchmarks when inlining the create_bin function.
I need to verify the code, 'coz I use Github's UI to resolve the conflict :p
hasAlpha
conditional outside of the hot path