Skip to content

Performance of RecurrenceArray #17

@ioannisPApapadopoulos

Description

@ioannisPApapadopoulos

Sometimes RecurrenceArray is slower than getindex when actually assembling the values e.g.

using ClassicalOrthogonalPolynomials
using SingularIntegrals

import ClassicalOrthogonalPolynomials: recurrenecoefficients
import SingularIntegrals: RecurrenceArray

P = Jacobi(1/3,1/3)
xc = range(-1,1; length=10000)
n = 10000

# getindex baseline ~ 1.102867 seconds
@time pp = P[xc,1:n];
# Lazy is fast ~  0.000466 seconds
@time pr = RecurrenceArray(xc, recurrencecoefficients(P), P[xc, 1:2]');
# Actually getting the matrix is "slow" ~ 1.706700 seconds 
@time pr[1:n,1:length(xc)]';

pr ≈ pp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions