Closed kawanet closed 3 months ago
The small patch draws pixels up to x27 times faster.
The current code draws a pixel with spread parameters drawPixel(output, pos, ...color).
drawPixel(output, pos, ...color)
The magic ... looks cool but runs slower compared to traditional coding styles still.
...
drawPixel(output, pos, color[0], color[1], color[2])
drawColorFn(output, color)(pos)
The benchmark above was tested on MacBook M1 Apple Silicon. Try it: https://gist.github.com/kawanet/4676a1804bb463ea558017b063d4c286
Apologies for not noticing this PR at the time. 🙏 Closing in favor of a slightly simpler optimization which is fast enough.
The small patch draws pixels up to x27 times faster.
The current code draws a pixel with spread parameters
drawPixel(output, pos, ...color)
.The magic
...
looks cool but runs slower compared to traditional coding styles still.drawPixel(output, pos, ...color)
drawPixel(output, pos, color[0], color[1], color[2])
drawColorFn(output, color)(pos)
The benchmark above was tested on MacBook M1 Apple Silicon. Try it: https://gist.github.com/kawanet/4676a1804bb463ea558017b063d4c286