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

Added segment index caching for more efficient interpolation of large… #429

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

AdsRSherman
Copy link

I added a cache to linear, cubic, and quadratic spline interpolators to prevent unnecessary binary searches.

Very simply, it won't redo a binary search if the last returned index is valid for the current query.

@cdrnet
Copy link
Member

cdrnet commented Aug 30, 2016

Thanks for proposing this change! It does indeed likely improve performance on typical use cases.

Unfortunately it does seem like this could break in multi-threaded use cases though, i.e. when the resulting interpolation is used concurrently from multiple threads.

@AdsRSherman
Copy link
Author

Gotcha. I can change the caches to ThreadLocal caches if that would help.

Also, I have n-degree lagrange and hermite polynomial interpolators that implement IInterpolation if you're interested. The algorithms were borrowed from JPL's SPICE toolkit.

@AdsRSherman
Copy link
Author

@cdrnet Added thread-local caches. In my testing this substantially improves performance, especially when abscissa are sparse and queries are dense.

@AdsRSherman
Copy link
Author

In other news, I'm not rightfully sure why those checks would have failed.

@AdsRSherman
Copy link
Author

@cdrnet

I have 3 other polynomial interpolations implemented: lagrange, hermite, and chebychev.

Is there interest in my adding those to the pr?

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

Successfully merging this pull request may close these issues.

2 participants