Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make prefiltering faster #33

Merged
merged 8 commits into from
May 28, 2015
Merged

Make prefiltering faster #33

merged 8 commits into from
May 28, 2015

Conversation

timholy
Copy link
Member

@timholy timholy commented May 16, 2015

This PR (which includes #32) makes prefiltering somewhat faster. In many cases the improvement is a bit disappointing, but when Woodbury can be avoided it's quite dramatic.

With current master (well, really with #32, so the deprecations don't slow things down):

julia> using Interpolations

julia> A = rand(300,301,30);

julia> it = Quadratic(Line(),OnGrid())  # requires Woodbury
Interpolations.Quadratic{Interpolations.Line,Interpolations.OnGrid}()

julia> itp = Interpolation(A, it, ExtrapError());

julia> @time Interpolation(A, it, ExtrapError());
elapsed time: 1.05831119 seconds (637 MB allocated, 8.97% gc time in 29 pauses with 0 full sweep)

julia> it = Quadratic(Flat(),OnCell())   # doesn't require Woodbury
Interpolations.Quadratic{Interpolations.Flat,Interpolations.OnCell}()

julia> itp = Interpolation(A, it, ExtrapError());

julia> @time Interpolation(A, it, ExtrapError());
elapsed time: 0.571626723 seconds (373 MB allocated, 10.14% gc time in 17 pauses with 0 full sweep)

With this PR:

julia> using Interpolations

julia> A = rand(300,301,30);

julia> it = Quadratic(Line(),OnGrid())  # requires Woodbury
Interpolations.Quadratic{Interpolations.Line,Interpolations.OnGrid}()

julia> itp = Interpolation(A, it, ExtrapError());

julia> @time Interpolation(A, it, ExtrapError());
elapsed time: 0.600699271 seconds (44 MB allocated, 15.04% gc time in 2 pauses with 2 full sweep)

julia> it = Quadratic(Flat(),OnCell())   # doesn't require Woodbury
Interpolations.Quadratic{Interpolations.Flat,Interpolations.OnCell}()

julia> itp = Interpolation(A, it, ExtrapError());

julia> @time Interpolation(A, it, ExtrapError());
elapsed time: 0.08264564 seconds (22 MB allocated, 9.55% gc time in 1 pauses with 0 full sweep)

It also allocates a lot less memory. With the new GC this isn't a huge issue, but neither is it a bad thing. It might lead to even greater benefits for smaller arrays.

@timholy
Copy link
Member Author

timholy commented May 16, 2015

I should add that this makes the prefiltering in Interpolations faster than Grid, too. Grid was a bit faster than Interplations master, but not by much; in a 2d case, I got 0.19 s for master Interpolations, .17 s for Grid, and 0.12 for this PR.

@timholy
Copy link
Member Author

timholy commented May 16, 2015

Note mostly to self: Grid seems to be able to do without Woodbury in a few more cases than Interpolations. Try to figure out why (important since it has a big performance impact).

Tomas Lycken and others added 8 commits May 18, 2015 22:34
This implements linear and quadratic interpolation, and constant
extrapolation.

The test suite is still in need of some love...
This isn't a huge improvement, but in my tests it allocates about
seven-fold less memory and runs in approximately 60% of the
time of the original. The improvement is much more dramatic for
cases where it doesn't have to use Woodbury, in which case it can be
more than 5x faster.

This also turns off pivoting to improve the cache behavior.
@timholy
Copy link
Member Author

timholy commented May 20, 2015

OK, this has been rebased on #31. I'll probably wait until that's merged to work on #34.

timholy added a commit that referenced this pull request May 28, 2015
@timholy timholy merged commit b67c920 into master May 28, 2015
@timholy timholy deleted the teh/fasterfiltering branch May 28, 2015 22:12
@timholy
Copy link
Member Author

timholy commented Jun 1, 2015

As an update, once JuliaLang/METADATA.jl#2670 merges, I will be able to contribute a further improvement in the Woodbury prefiltering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant