Add FastInterpolations as a faster resampling backend - #5706
Conversation
Resampler and its Pyramid payload now build interpolants with FastInterpolations (LinearInterp) instead of Interpolations (Linear). Passing an Interpolations degree still selects the old path, so the change is additive; output matches the previous linear result to floating-point round-off (Resampler ~1 ulp, Pyramid bit-identical). The curvilinear contourf remap also uses FastInterpolations now (internal, identical output).
|
For the maintainers' information: |
|
/benchmark 30 Oh, nvm, benchmarks don't work with branches on forks. I wanted to check if this influences using time, just in case |
…resampler-fastinterpolations-backend
|
For maintainters' information: @ffreyer |
Hi!
I'm the author of FastInterpolations.jl, a new high-performance interpolation package, and I'm looking for more places to use it.
I found that
Resampler(and itsPyramidpayload) looks like a nice fit; it resamples on every pan/zoom, so faster interpolation helps interactivity.This PR adds a small, shallow wrapper so
Resampler(and itsPyramidpayload) can use theFastInterpolationsAPI through the existingmethod/modekeyword.In the real per-frame resampling path, FastInterpolations is 2–9× faster than
Interpolations.jland matches the current output to floating-point round-off. So I madeFastInterpolations.LinearInterp()the default; anything that already usedInterpolationsdirectly keeps working, and reverting the default is a one-line change.In addition, the curvilinear
contourfremap now also uses FastInterpolations — internal only, with identical output.Benchmarks
Interpolations.jl's
Linear()vs. the new default FastInterpolations.jl'sLinearInterp(), measured through the realresample_image(the per-frame function):a (2000x2000) source, either a
Float32field and anRGB{N0f8}photo-like image, downsampled to (500x500) for display.Float32RGB{N0f8}Float32RGB{N0f8}The following is a benchmark script for the table above:
This PR needs FastInterpolations 0.4.16, pinned in
[compat].Thanks for taking a look, any feedbacks and thoughts are welcome!