Make larry.push() faster #53

Closed
kwgoodman opened this Issue Mar 8, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Owner

kwgoodman commented Mar 8, 2012

Make larry.push() faster by avoiding a copy.

Old:

I[1] lar = la.rand(1000, 1000)
I[2] lar[lar > 0.8] = np.nan
I[3] timeit lar.push(100)
10 loops, best of 3: 82 ms per loop

New:

I[1] lar = la.rand(1000, 1000)
I[2] lar[lar > 0.8] = np.nan
I[3] timeit lar.push(100)
10 loops, best of 3: 77 ms per loop

Old:

    y = self.copy()
    y.x = push(y.x, window, axis=axis)
    return y

New:

    label = self.copylabel()
    x = push(self.x, window, axis=axis)
    return larry(x, label, validate=False)

@kwgoodman kwgoodman closed this in 8eb5778 Mar 8, 2012

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