Member-only story
🖍️ Speed Up Your Color Manipulations with This JavaScript Library
Discover how to supercharge your color processing in JavaScript with a new library by developer romgrk. By leveraging 32-bit numbers and bitwise operations, this library boasts up to 5x the performance
A developer under the nick of romgrk shared an interesting article about improving the processing of RGBA colors in JavaScript.
This article was brought to you thanks to 18 thousand followers on Medium
He noticed that colors are stored by JavaScript as objects, while representing them as 32-bit numbers and encoding with bitwise operations would make color manipulations much more efficient due to lower memory pressure and better handling by garbage collector.
He uses direct character code manipulations that are much faster and memory efficient. The library is said to be faster up to 5 times than colord, tinycolor2 and chroma-js.
If you like the article follow me and subscribe for more!
It was quite interesting to learn that the >>> (unsigned right shift operator) works only unsigned uint32 numbers.