paulirish/speedline

Faster histogram creation

Closed this issue · 0 comments

If I get a chance I'll take a crack at it but browsing through the code the image pixel processing jumped out at me.

The histogram extraction logic runs through the image top-to-bottom and then across (and repeats for each color channel).

The images are stored in RAM on a row-by-row basis with each pixel color-packed as sequential bytes. As it stands now the CPU caches will be thrashing on the image data. Flipping the for loops to have the height on the outside, width in the middle and color channel on the inside will be much friendlier to the CPU caches and should be a lot faster.