perf(native): faster color blending#870
Conversation
|
This would replace #498, since you make the same change. in general i would try to limit this to one-idea per pr. You both add a bunch of early outs + replace the pow in this one. |
|
I've triggered a run for your branch at https://opentui-bench.fly.dev/ ~30 min and it should show up there. |
yeah sorry i hope the fact it's a follow up of #865 doesn't make it harder to review. i just preferred to open a separate pr since color blending felt unrelated. i'll add the opacity benchmark in #865 instead so both pr can be merged separately. but we won't have the benchmarks on this branch. i'll remove the condition that's already covered by #498 :) did you stumble on anything that stopped you from merging that pr, or was it just forgotten? |
65637b7 to
cf1bba5
Compare
|
i added a separate benchmark here for color blending / translucency, and moved the box opacity benchmark to #865. hope it's clearer now, sorry about that |
this pr makes a small change to the color blending function (roughly 4x faster now) which improves prefs for draw calls with translucent colors and for postprocessing draws (
drawSuperSampleBuffer,drawGrayscaleBuffer, etc).i replaced the use of
std.math.powwith a faster approximate pow.the approximate pow is a not 100% accurate so the result does not fully match
std.math.powbut for color blending the change is (very) hardly noticeable.benchmark (left with
std.math.pow, right with approximate pow)color comparison (left with
std.math.pow, right with approximate pow)screenrecording-2026-03-24_15-46-04.mp4