verdigris / splat

Generative audio library in Python
4 stars 3 forks source link

Improve spline performance #7

Closed gctucker closed 9 years ago

gctucker commented 10 years ago

The spline used as signal is about 100x slower than a fragment. Here's the benchmark result with build-0014:

name rank runs mean sd timesBaseline
ref 1 15 0.01619 0.003303 1.0
offset frag 2 15 0.1041 0.01072 6.4306119323
offset spline 3 15 12.91 0.1645 797.216189174

It is all implemented in pure Python, so a first step would be to implement in C the part that finds the polynomial and calculates the spline value.

gctucker commented 9 years ago

As a result of pull request #8:

name rank runs mean sd timesBaseline
ref 1 15 0.01469 0.0001716 1.0
offset spline 2 15 0.06803 0.0004666 4.63094029893
offset frag 3 15 0.07936 0.00114 5.40237471301
offset spline value 4 15 3.256 0.03135 221.659607157

The "offset spline value" uses the same PolyList.value() method as for the first benchmark, whereas the "offset spline" uses the new optimised PolyList.signal() method especially designed for faster signals.

Performance improvement is over 100x with these changes. Closing the issue now.

gctucker commented 9 years ago

This is now in build-0015 12e94d49b489745033256a6fa63103d88e0af359