Traneptora / jxlatte

Java JPEG XL decoder
MIT License
45 stars 5 forks source link

Improve image decoding performance by modifying MathHelper.min(int...) and MathHelper.max(...) #25

Closed terranprog closed 1 year ago

terranprog commented 1 year ago

Replace functional code with imperative code in MathHelper.min(int..) and MathHelper.max(...). Improves performance of image decoding by around 20%.

Some sample timings to decode 20 1000x1000 images Timings are in milliseconds

Original code Time to process 20 jxl files is 4004 Time to process 20 jxl files is 3919 Time to process 20 jxl files is 3882

Average: 3935

With this PR Time to process 20 jxl files is 3316 Time to process 20 jxl files is 3203 Time to process 20 jxl files is 3298

Average: 3272

Reduction = 17%

Traneptora commented 1 year ago

I made a similar commit on git master, try now.

terranprog commented 1 year ago

I updated to latest master and saw similar improvements in performance

Time to process 20 jxl files is 3189 Time to process 20 jxl files is 3086 Time to process 20 jxl files is 3163