# Using Interpolations

**URL:** https://discourse.julialang.org/t/using-interpolations/23933
**Category:** New to Julia
**Tags:** interpolations
**Created:** [May 6, 2019, 8:44pm UTC](https://discourse.julialang.org/t/using-interpolations/23933 "2019-05-06T20:44:05Z")
**Posts on this page:** 1
**Showing post:** 31

<div class="post-metadata">

### Author: ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)
#### Post date: [May 8, 2019, 1:53pm UTC](https://discourse.julialang.org/t/using-interpolations/23933/31 "2019-05-08T13:53:38Z")

</div>

A number of performance problems have now been fixed and are available in Interpolations 0.12.

Just as Interpolations was “cheating” on your first example, Dierckx is “cheating” on your second. You can see this if you try

```julia
p = randperm(length(xs))
xsr = xs[p]
@btime $fit1($xs)
@btime $fit1($xsr)

```

This explains most of the remaining gap; Interpolations relies on `searchsortedfirst` to find the bracketing knots for the interpolation point, but if you traverse them in order you can find the next knot more efficiently. It would be good if someone implements this form of “cheating” for Interpolations, too.

For 1d gridded interpolation, almost all of the time is spent in `searchsortedfirst`. Someone who wants to make it this package faster in such cases might well take a careful look at this function and see if there are untapped performance opportunities. (As well as adding the “cheating” for sorted vector inputs.)

---

_[View the full topic](https://discourse.julialang.org/t/using-interpolations/23933)._
