Performance · re-timed 15 November 2026
Speed, measured against NumPy and SciPy
Every NumPy and SciPy function family, timed against the reference on the same inputs and the same machine, single-threaded on both sides. The wins and the losses are both on this page.
3.2x
faster per call on average through the FFI package, across 1,022 NumPy and SciPy functions; faster on 754
13x
through the native extension, faster on 966 of 1,022. On heavy computations, where the work itself dominates, the extension and the FFI package take the same time.
More than 8 in 10
SciPy functions faster per call (532 of 644)
19.7x
largest lead on a heavy workload: scipy.interpolate make_interp_spline k=3, 1M points
21
special functions where SciPy crashed or ran for hours on the test inputs, and Tessero returned results
Not faster everywhere: see where NumPy and SciPy still lead. Every figure here is parsed from the library's sweep record, never hand-typed.
How it was measured
Every function family timed against NumPy 2.4.4 / SciPy 1.17.1, on the same inputs, single-threaded on both sides
(OPENBLAS_NUM_THREADS=1), on the benchmark machine of benchmarks (Intel Core i7-4790, Haswell,
AVX2; PHP 8.5.12, FFI backend unless the native extension is named): four alternating rounds of each side, each
case keeping its best time, while the host carried other work (load average 5 to 26 on 8 hardware threads). A ratio
is Tessero time / reference time: below 1, Tessero is faster.
First run on 2026-11-06; every tier re-timed on 2026-11-15 at commit 56102533 (see Method); the known gaps and the cases changed since were timed again at commit d2d4e2e6.
Per-call figures compare a PHP program calling Tessero with a Python program calling NumPy and SciPy, on the inputs of the parity suite, which are mostly small. That is the cost a caller pays each time a function runs. Heavy workloads time realistic sizes the same way on both sides.
| What is timed | Timed | Ratio | Tessero faster |
|---|---|---|---|
| all scipy.special element-wise functions, 100,000 values each (the parity fixture inputs, tiled) | 212 functions | 0.94 | 103 |
| 88 heavier calls at realistic sizes (linalg, FFT, signal, ndimage, interpolate, integrate, optimize, stats, sparse, csgraph, spatial, cluster) | 88 cases | 0.70 | 64 |
| per-call latency of every parity fixture call (small inputs) | 1,022 functions, 15,184 cases | 0.30 | 754 |
Ratio: Tessero's time over the reference's, geometric mean. Below 1, Tessero is faster.
Reproduce it with the scripts in the library repository: bench/tier2_bench.php and
bench/tier2_bench.py for the heavy workloads, and tools/parity/run-tests.php --time
with tools/parity/time_calls.py for the per-call timings.
The full sweep record, every case →
The full method, from the sweep record
- Tier 1: the
scipy.specialelement-wise blocks of the parity fixtures (tests/fixtures/parity/special.json), each argument column tiled to 100,000 values; median of repeated runs (bench/tier1_bench.phpandbench/tier1_bench.py, the first float64 block of each function; SciPy runs each function in a child process, so one that crashes or hangs on the fixture rows is reported as failed). - Tier 2:
bench/tier2_bench.phpandbench/tier2_bench.py, the same calls on the same inputs (seeded generators: Tessero's PCG64 streams match NumPy's); median of repeated runs, fast calls in an inner loop. - Tier 3:
tools/parity/run-tests.php --timetimes every fixture call that passed its check (same arguments, 3-200 repetitions, median),tools/parity/time_calls.pytimes the same cases in NumPy/SciPy, andtools/parity/time_report.pypairs them case for case. Stateful calls (seeded generators, frozen distributions) and in-place calls are left out; so are 87 functions that could not be resolved in the Python namespaces and 988 cases that raised in SciPy. - The run behind the tables: every tier timed on 2026-11-15 at commit 56102533 (the build deployed that day): four
rounds, each running in turn the gate bench of benchmarks (
bench/run.php, thenbench/numpy_bench.py), tier 1, tier 2, and tier 3 through FFI, through the extension and in NumPy/SciPy, single-threaded (OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1), at a load average of 5 to 26 on 8 hardware threads; then four rounds ofbench/usage_bench.php(FFI, extension) andbench/usage_bench.pyfor the usage-weighted mix. Each case keeps its best time on each side, as the host carries unrelated load. Ratios within 10% are read as on par. - Timed again after the sweep: the known gaps and the cases changed since, on 2026-11-15 at commit d2d4e2e6 (the
installed library), with
bench/tier2_bench.phpandbench/tier2_bench.py: each case alone, eight alternating rounds of FFI, the extension and NumPy/SciPy (18:42 to 18:47 UTC, at a load average of 8 to 14), each side's best. TheKDTreebuild keeps the sweep's figure. These are the times in "Known gaps" and in the re-timed rows of "Fixed after the sweep". - Results unchanged: since 2026-11-09 every speed change is also checked against the parity suite's recorded
results (
tools/parity/run-tests.php --hash), 47,869 results, on the code before and after the change: none changed. bench/sweep_report.pycompares any two{case: ms}result files.
Sorting a million values
1.8x to 1.9x
faster than np.sort on random data, with Tessero's sort() on 4 threads (the sortSimd column). NumPy's sort is single-threaded.
4.7x to 5.5x
faster than np.sort's default on sorted or reversed input. NumPy's stable sort is faster still there.
Level
on one thread with NumPy's own vectorized sort: float64 1.2x slower, float32 1.2x slower, int64 1.01x faster.
NDArray::sortSimd() (an AVX2 quicksort with in-register sorting networks) uses the threads set with
Tessero::setThreads(); NumPy's np.sort uses one. With four threads it sorts a million random values about 2x
faster than NumPy (float64 1.8x, float32 1.9x, int64 1.9x); on one thread it runs level with NumPy, whose default
sort on this machine is Intel's x86-simd-sort vector quicksort (int64 equal, float types up to 1.2x behind). On sorted
or reversed input it is about 5x faster than np.sort's default; NumPy's kind='stable' (Timsort) is faster still
there, and on values appended to a sorted array. All of Tessero's sorts return the same result as np.sort.
Milliseconds, 1,000,000 values, best of 7 calls in each of 5 alternating rounds; each call returns a new sorted array on both sides (PHP app vs Python app). Fastest in bold.
| Data, 1M values | np.sort | np.sort stable | sortSimd | sortSimd 4 threads | sortRuns | radix |
|---|---|---|---|---|---|---|
| float64 random | 13.7 | 76.3 | 17.1 | 7.7 | 86.1 | 37.1 |
| float64 10 distinct values | 3.8 | 32.2 | 5.7 | 4.0 | 49.0 | 23.8 |
| float64 sorted | 13.8 | 1.7 | 2.5 | 2.4 | 4.2 | 35.1 |
| float64 reversed | 14.0 | 2.2 | 3.0 | 2.9 | 4.8 | 34.9 |
| float64 sorted, 1% of values moved | 14.2 | 15.9 | 15.6 | 7.1 | 32.9 | 34.9 |
| float64 sorted, 1% random values appended | 14.2 | 3.2 | 16.8 | 7.8 | 26.1 | 34.8 |
| float32 random | 7.4 | 74.1 | 8.9 | 3.9 | 74.7 | 33.8 |
| int64 random | 18.5 | 69.7 | 18.4 | 9.6 | 84.4 | 30.2 |
Where NumPy's sorts lead
-
float64 10 distinct values:
np.sort3.8 ms, Tessero's fastest (sortSimd 4 threads) 4.0 ms -
float64 sorted:
np.sort stable1.7 ms, Tessero's fastest (sortSimd 4 threads) 2.4 ms -
float64 reversed:
np.sort stable2.2 ms, Tessero's fastest (sortSimd 4 threads) 2.9 ms -
float64 sorted, 1% random values appended:
np.sort stable3.2 ms, Tessero's fastest (sortSimd 4 threads) 7.8 ms
sortRuns() (a natural merge sort) is meant for mostly sorted data on machines without AVX2, where sortSimd() falls
back to the radix sort; it does not beat NumPy's Timsort. sort() is now the AVX2 sort as well (its time is the
sortSimd column); the radix column is the radix sort, the path of CPUs without AVX2. Scripts: bench/sort_bench.php and bench/sort_bench.py; measured on commit 8ce79ab3 under the
host load described in Method, so single-thread results within about 20% vary between runs (the multi-thread
advantage held in every run). How the sorts work and their tests: sorting design.
Per call, by module
Where SciPy runs Python code around its compiled core, Tessero makes one call into a compiled kernel, so small calls are where it gains most. Through the FFI package, NumPy's own core, compiled all the way down, still leads.
Tier 3 again with the native extension (ext/) instead of FFI, re-timed on 2026-11-15 at commit 56102533: every
parity fixture call that passed its check, the same cases, timed through Tessero\Ext\*. The extension calls the
same kernel without the FFI layer, which costs a few microseconds per call; where the work itself dominates, the two
backends take the same time (stats.tukey_hsd: 37 ms on both, SciPy 45 ms). Against NumPy/SciPy the extension is
about 13x faster per call on average (geomean 0.074) and faster on 966 of 1,022 functions, NumPy's own core
functions included (0.29; through FFI they are about 1.6x slower). Of the 56 functions still slower, 36 are within
1.3x, and 33 take NumPy/SciPy under a microsecond per call (shape, ndim, promote_types); some return the input
or a view in NumPy where Tessero returns a copy (ascontiguousarray, asfortranarray, atleast_1d).
Best of four runs on each side, alternating with the FFI runs, at a load average of 5 to 26 (on 2026-11-10, at commit c5f434b0, the same method gave 0.12 and 887; at commit ad837126 0.12 and 890, at commit 655992c6 0.12 and 882; on 2026-11-06, at commit 2184ba75 and at times above 40, three runs had given 0.11 and 893):
This is a per-call result: the extension removes the FFI layer's cost on every call. It does not make heavy computations faster; where the work itself dominates, both backends take the same time.
| Module | FFI package | Native extension | ||||
|---|---|---|---|---|---|---|
| Faster | Ratio | Per call | Faster | Ratio | Per call | |
| scipy.sparse.csgraph | 14 of 14 | 0.03 | at least 28x faster | 14 of 14 | 0.00 | at least 200x faster |
| scipy.interpolate | 6 of 6 | 0.03 | at least 28x faster | 6 of 6 | 0.01 | at least 66x faster |
| scipy.stats | 108 of 111 | 0.03 | at least 28x faster | 111 of 111 | 0.01 | at least 66x faster |
| scipy.cluster.hierarchy | 26 of 26 | 0.04 | at least 22x faster | 26 of 26 | 0.01 | at least 66x faster |
| scipy.sparse.linalg | 14 of 14 | 0.04 | at least 22x faster | 14 of 14 | 0.01 | at least 66x faster |
| scipy.cluster.vq | 4 of 4 | 0.12 | at least 8.0x faster | 4 of 4 | 0.03 | at least 28x faster |
| scipy.signal | 109 of 124 | 0.15 | at least 6.4x faster | 121 of 124 | 0.04 | at least 22x faster |
| scipy.sparse | 21 of 23 | 0.19 | at least 5.1x faster | 23 of 23 | 0.03 | at least 28x faster |
| scipy.linalg | 85 of 87 | 0.23 | at least 4.2x faster | 87 of 87 | 0.06 | at least 15x faster |
| numpy.polynomial | 139 of 155 | 0.34 | at least 2.8x faster | 155 of 155 | 0.06 | at least 15x faster |
| scipy.signal.windows | 21 of 25 | 0.38 | at least 2.5x faster | 25 of 25 | 0.06 | at least 15x faster |
| scipy.spatial.distance | 25 of 26 | 0.39 | at least 2.5x faster | 26 of 26 | 0.11 | at least 8.6x faster |
| scipy.ndimage | 52 of 66 | 0.40 | at least 2.4x faster | 66 of 66 | 0.09 | at least 10x faster |
| scipy.special | 39 of 89 | 0.69 | at least 1.4x faster | 79 of 89 | 0.28 | at least 3.5x faster |
| numpy.linalg | 18 of 30 | 0.82 | at least 1.2x faster | 30 of 30 | 0.23 | at least 4.2x faster |
| scipy.fft | 3 of 11 | 0.95 | on par | 3 of 11 | 0.58 | at least 1.7x faster |
| numpy.fft / scipy.fft | 5 of 18 | 1.26 | 1.3x slower | 17 of 18 | 0.38 | at least 2.5x faster |
| numpy | 65 of 193 | 1.56 | 1.6x slower | 159 of 193 | 0.29 | at least 3.3x faster |
Ratio as the sweep rounds it, geometric mean over the module's functions. A speed-up is the least that rounded ratio allows (0.06 reads as at least 15x, not 17x). SciPy's share counts every module that holds SciPy calls, the mixed FFT module included.
Weighted by real use
The module figures count every function once. Real code calls a few functions far more often than the rest, so here each per-call time counts as often as widely used scientific Python packages call it.
| Mix | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| real-usage mix weighted over 36,696 calls | 7.20 µs | 0.75 µs 9.6x faster faster on 92% of calls | 4.41 µs 1.6x faster faster on 19% of calls |
| ML operations weighted over 20 functions | 1.45 µs | 0.40 µs 3.6x faster faster on 95% of calls | 3.70 µs 2.6x slower faster on 20% of calls |
Weighted mean time per call, small inputs. The speed-up is NumPy/SciPy's time over Tessero's; within 10% either way reads as on par.
Tier 3 counts every function once; real code does not call them equally. Here each function's per-call time is
weighted by how often the library code of 18 widely used scientific Python packages calls it (the corpus of the
usage-weighted coverage: 40,188 calls to in-scope NumPy and SciPy functions; calls to
excluded symbols are left out). The time of a mix is the sum over its functions of the per-call time times the
function's corpus calls, divided by those calls. The functions timed (tier 3, plus bench/usage_bench.php and
bench/usage_bench.py for the most-called functions tier 3 does not time) carry 36,696 of the 40,188 calls. The
inputs are small (the fixture and usage-bench inputs), so the fixed cost of a call dominates.
ML operations: numpy.dot, numpy.exp, numpy.log, numpy.sum, numpy.mean, numpy.max, numpy.min,
numpy.argmax, numpy.argmin, numpy.where, numpy.sqrt, numpy.clip, numpy.maximum, numpy.zeros,
numpy.asarray, numpy.concatenate, numpy.argsort, numpy.unique, numpy.linalg.norm, numpy.absolute.
"Faster on" is the share of the mix's weighted calls that go to functions where Tessero's per-call time is below
NumPy/SciPy's. Through FFI the real-usage mix as a whole takes less time than in NumPy/SciPy, yet is faster on only
a fifth of its calls. NumPy's core functions make 96% of the calls (array, asarray, zeros, dot, sqrt lead)
and cost NumPy 2.7 us per call on average, Tessero 4.1 us through FFI. The SciPy functions make 4% of the calls but
about two thirds of the NumPy/SciPy time, 117 us per call on average in SciPy's Python-level wrappers against 12.8 us
in Tessero. The native extension removes the FFI layer's cost: 0.56 us per call on NumPy's core functions, 5.4 us on
SciPy's.
The inputs here are small. Large matrix products run in OpenBLAS on both sides and are on a par: a 600 x 600
matmul takes 9.1 ms against NumPy's 9.9 ms in this sweep's run of the benchmarks bench.
Classical machine learning
The functions classical machine learning code calls, scikit-learn style: array creation and validation, shape
manipulation, matrix products, reductions, indexing and decisions, element-wise math, random sampling,
optimization, sparse matrices, linear algebra, distances and neighbours, special functions and distributions. Each
function's per-call time on small inputs (the tier 3 rows, bench/usage_bench.php and bench/ml_bench.php for the
rest, against their Python counterparts) is weighted by its static call count: in the library code of the 18
corpus packages, and in scikit-learn's alone (scikit-learn 1.9.1, 2,044 calls to these functions; the per-package
counts are in tools/parity/usage.json).
Weighted by how 18 widely used scientific Python packages call them
| Category | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| Array creation and validation weighted over 9,218 calls | 0.49 µs | 0.21 µs 2.3x faster faster on 100% of calls | 2.66 µs 5.4x slower faster on 0% of calls |
| Shape and joining weighted over 1,647 calls | 1.35 µs | 1.06 µs 1.3x faster faster on 50% of calls | 5.64 µs 4.2x slower faster on 0% of calls |
| Matrix products weighted over 1,649 calls | 0.93 µs | 0.43 µs 2.2x faster faster on 100% of calls | 5.52 µs 5.9x slower faster on 0% of calls |
| Reductions weighted over 1,930 calls | 3.30 µs | 0.34 µs 9.7x faster faster on 100% of calls | 1.84 µs 1.8x faster faster on 94% of calls |
| Indexing and selection weighted over 1,277 calls | 1.10 µs | 0.36 µs 3.1x faster faster on 100% of calls | 4.86 µs 4.4x slower faster on 0% of calls |
| Element-wise math weighted over 3,149 calls | 0.63 µs | 0.32 µs 2.0x faster faster on 100% of calls | 4.04 µs 6.4x slower faster on 0% of calls |
| Optimization weighted over 34 calls | 873 µs | 29.9 µs 29.2x faster faster on 100% of calls | 48.8 µs 17.9x faster faster on 100% of calls |
| Sparse matrices weighted over 45 calls | 70.5 µs | 1.49 µs 47.3x faster faster on 100% of calls | 10.4 µs 6.8x faster faster on 100% of calls |
| Linear algebra weighted over 90 calls | 68.7 µs | 3.87 µs 17.8x faster faster on 100% of calls | 11.1 µs 6.2x faster faster on 100% of calls |
| Distances and neighbours weighted over 65 calls | 10.1 µs | 1.16 µs 8.7x faster faster on 100% of calls | 5.97 µs 1.7x faster faster on 60% of calls |
| Special functions weighted over 32 calls | 74.5 µs | 0.91 µs 81.9x faster faster on 69% of calls | 4.52 µs 16.5x faster faster on 69% of calls |
| The whole set weighted over 19,136 calls | 3.14 µs | 0.42 µs 7.5x faster faster on 96% of calls | 3.61 µs 1.1x slower faster on 11% of calls |
Weighted by how scikit-learn alone calls them
| Category | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| Array creation and validation weighted over 895 calls | 0.44 µs | 0.20 µs 2.2x faster faster on 100% of calls | 2.49 µs 5.7x slower faster on 0% of calls |
| Shape and joining weighted over 197 calls | 1.45 µs | 0.96 µs 1.5x faster faster on 77% of calls | 5.20 µs 3.6x slower faster on 0% of calls |
| Matrix products weighted over 213 calls | 0.92 µs | 0.43 µs 2.1x faster faster on 100% of calls | 5.51 µs 6.0x slower faster on 0% of calls |
| Reductions weighted over 288 calls | 3.21 µs | 0.37 µs 8.7x faster faster on 100% of calls | 2.02 µs 1.6x faster faster on 88% of calls |
| Indexing and selection weighted over 129 calls | 1.23 µs | 0.34 µs 3.6x faster faster on 100% of calls | 3.53 µs 2.9x slower faster on 0% of calls |
| Element-wise math weighted over 232 calls | 0.65 µs | 0.32 µs 2.0x faster faster on 100% of calls | 4.10 µs 6.3x slower faster on 0% of calls |
| Optimization weighted over 10 calls | 979 µs | 32.7 µs 29.9x faster faster on 100% of calls | 34.2 µs 28.6x faster faster on 100% of calls |
| Sparse matrices weighted over 17 calls | 83.5 µs | 1.42 µs 58.8x faster faster on 100% of calls | 11.1 µs 7.5x faster faster on 100% of calls |
| Linear algebra weighted over 45 calls | 63.5 µs | 4.04 µs 15.7x faster faster on 100% of calls | 11.4 µs 5.6x faster faster on 100% of calls |
| Distances and neighbours weighted over 11 calls | 9.93 µs | 0.96 µs 10.3x faster faster on 100% of calls | 4.96 µs 2.0x faster faster on 55% of calls |
| Special functions weighted over 7 calls | 15.8 µs | 0.65 µs 24.3x faster faster on 14% of calls | 4.42 µs 3.6x faster faster on 14% of calls |
| The whole set weighted over 2,044 calls | 8.02 µs | 0.60 µs 13.4x faster faster on 97% of calls | 3.69 µs 2.2x faster faster on 16% of calls |
Not weighted: calls the corpus cannot count
| Category | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| Random sampling weighted over 4 functions | 3.83 µs | 0.52 µs 7.4x faster faster on 100% of calls | 13.2 µs 3.4x slower faster on 0% of calls |
| Distributions weighted over 3 functions | 49.9 µs | 1.10 µs 45.4x faster faster on 100% of calls | 9.11 µs 5.5x faster faster on 100% of calls |
By model type
Weighted by how 18 widely used scientific Python packages call them
| Model type | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| linear and logistic dot, matmul, mean, clip, log, minimize, lstsq, expit, csr_matrix | 10.3 µs | 0.66 µs 15.6x faster faster on 100% of calls | 5.00 µs 2.1x faster faster on 16% of calls |
| tree ensembles argsort, bincount, where, argmax, csc_matrix | 1.57 µs | 0.41 µs 3.8x faster faster on 100% of calls | 5.18 µs 3.3x slower faster on 1% of calls |
| clustering and neighbours argmin, mean, std, sum, cdist, cKDTree | 3.12 µs | 0.33 µs 9.5x faster faster on 100% of calls | 1.75 µs 1.8x faster faster on 92% of calls |
| dimensionality reduction dot, mean, var, svd, eigh, svds | 4.11 µs | 0.48 µs 8.6x faster faster on 100% of calls | 4.63 µs 1.1x slower faster on 27% of calls |
Weighted by how scikit-learn alone calls them
| Model type | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| linear and logistic dot, matmul, mean, clip, log, minimize, lstsq, expit, csr_matrix | 27.1 µs | 1.24 µs 21.9x faster faster on 98% of calls | 5.47 µs 5.0x faster faster on 19% of calls |
| tree ensembles argsort, bincount, where, argmax, csc_matrix | 1.76 µs | 0.45 µs 3.9x faster faster on 100% of calls | 4.03 µs 2.3x slower faster on 1% of calls |
| clustering and neighbours argmin, mean, std, sum, cdist, cKDTree | 2.98 µs | 0.32 µs 9.3x faster faster on 100% of calls | 1.71 µs 1.7x faster faster on 93% of calls |
| dimensionality reduction dot, mean, var, svd, eigh, svds | 9.42 µs | 0.83 µs 11.3x faster faster on 100% of calls | 5.25 µs 1.8x faster faster on 33% of calls |
Weighted mean time per call, small inputs. The speed-up is NumPy/SciPy's time over Tessero's; within 10% either way reads as on par.
The heavy calls, at realistic sizes
Most of a model's running time goes to a few large calls, many of them in BLAS and LAPACK on both sides.
| Case | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|
| numpy.matmul 2000x2000 | 327 ms | 325 ms on par | 321 ms on par |
| scipy.linalg.svd 1000x1000 (full) | 503 ms | 608 ms 1.2x slower | 555 ms 1.1x slower |
| scipy.linalg.eigh 1000x1000 | 262 ms | 246 ms on par | 258 ms on par |
| scipy.linalg.solve 1000x1000 | 31.5 ms | 27.7 ms 1.1x faster | 26.6 ms 1.2x faster |
| scipy.linalg.cholesky 1000x1000 | 13.8 ms | 14.4 ms on par | 14.6 ms on par |
| scipy.linalg.lstsq 10,000 x 50 | 13.7 ms | 13.8 ms on par | 14.4 ms on par |
| scipy.sparse.linalg.svds k=10, 2,000 x 500 (dense input) | 137 ms | 88.1 ms 1.6x faster | 87.2 ms 1.6x faster |
| scipy.spatial.distance.pdist 2,000 x 50 (euclidean) | 45.4 ms | 69.4 ms 1.5x slower | 67.0 ms 1.5x slower |
| scipy.spatial.distance.cdist 1,000 x 1,000 x 50 (euclidean) | 21.7 ms | 32.8 ms 1.5x slower | 32.7 ms 1.5x slower |
| scipy.spatial.cKDTree build 100,000 x 3 | 27.5 ms | 28.4 ms on par | 30.8 ms 1.1x slower |
| scipy.spatial.cKDTree query 1,000 points, k=5 | 2.02 ms | 2.55 ms 1.3x slower | 3.28 ms 1.6x slower |
| logistic regression, L-BFGS-B, 10,000 x 50 | 21.2 ms | 59.2 ms 2.8x slower | 81.7 ms 3.9x slower |
| logistic regression, Newton-CG, 10,000 x 50 | 3544 ms | 3307 ms on par | 3614 ms on par |
| logistic regression, TNC, 10,000 x 50 | 60.6 ms | 141 ms 2.3x slower | 156 ms 2.6x slower |
| scipy.special.expit 1M | 7.64 ms | 9.87 ms 1.3x slower | 10.5 ms 1.4x slower |
| scipy.special.logsumexp 1M | 16.9 ms | 8.70 ms 1.9x faster | 8.37 ms 2.0x faster |
| scipy.stats.norm.logpdf 1M | 24.1 ms | 18.5 ms 1.3x faster | 18.8 ms 1.3x faster |
Every function, per call (51)
| Function | Calls, 18 packages | Calls, scikit-learn | NumPy/SciPy | Native extension | FFI package |
|---|---|---|---|---|---|
| numpy.asarray Array creation and validation | 2,335 | 212 | 0.56 µs | 0.24 µs 2.3x faster | 2.96 µs 5.3x slower |
| numpy.array Array creation and validation | 3,265 | 186 | 0.57 µs | 0.23 µs 2.5x faster | 2.87 µs 5.0x slower |
| numpy.zeros Array creation and validation | 2,094 | 276 | 0.25 µs | 0.17 µs 1.5x faster | 1.87 µs 7.5x slower |
| numpy.ones Array creation and validation | 724 | 73 | 0.93 µs | 0.18 µs 5.2x faster | 3.97 µs 4.3x slower |
| numpy.empty Array creation and validation | 800 | 148 | 0.25 µs | 0.17 µs 1.5x faster | 1.80 µs 7.2x slower |
| numpy.reshape Shape and joining | 155 | 24 | 0.83 µs | 0.24 µs 3.5x faster | 1.31 µs 1.6x slower |
| numpy.ravel Shape and joining | 151 | 27 | 0.47 µs | 0.21 µs 2.2x faster | 1.24 µs 2.6x slower |
| numpy.expand_dims Shape and joining | 62 | 6 | 1.78 µs | 0.85 µs 2.1x faster | 6.63 µs 3.7x slower |
| numpy.concatenate Shape and joining | 823 | 46 | 1.23 µs | 1.31 µs on par | 6.72 µs 5.5x slower |
| numpy.vstack Shape and joining | 233 | 48 | 2.13 µs | 1.19 µs 1.8x faster | 6.60 µs 3.1x slower |
| numpy.hstack Shape and joining | 223 | 46 | 1.83 µs | 1.20 µs 1.5x faster | 6.39 µs 3.5x slower |
| numpy.dot Matrix products | 1,530 | 201 | 0.86 µs | 0.36 µs 2.4x faster | 5.43 µs 6.3x slower |
| numpy.matmul Matrix products | 36 | 2 | 1.20 µs | 0.36 µs 3.3x faster | 5.29 µs 4.4x slower |
| numpy.einsum Matrix products | 83 | 10 | 2.09 µs | 1.74 µs 1.2x faster | 7.33 µs 3.5x slower |
| numpy.sum Reductions | 1,202 | 172 | 2.31 µs | 0.27 µs 8.6x faster | 1.71 µs 1.4x faster |
| numpy.mean Reductions | 452 | 60 | 3.84 µs | 0.38 µs 10.1x faster | 1.40 µs 2.7x faster |
| numpy.std Reductions | 92 | 10 | 10.9 µs | 0.42 µs 26.0x faster | 1.54 µs 7.1x faster |
| numpy.var Reductions | 60 | 12 | 10.1 µs | 0.42 µs 24.0x faster | 1.55 µs 6.5x faster |
| numpy.bincount Reductions | 124 | 34 | 1.95 µs | 0.79 µs 2.5x faster | 5.00 µs 2.6x slower |
| numpy.argmax Indexing and selection | 148 | 42 | 1.23 µs | 0.28 µs 4.4x faster | 1.81 µs 1.5x slower |
| numpy.argmin Indexing and selection | 117 | 12 | 1.18 µs | 0.28 µs 4.2x faster | 1.83 µs 1.6x slower |
| numpy.argsort Indexing and selection | 261 | 40 | 1.51 µs | 0.39 µs 3.9x faster | 3.26 µs 2.2x slower |
| numpy.where Indexing and selection | 751 | 35 | 0.92 µs | 0.37 µs 2.5x faster | 6.50 µs 7.1x slower |
| numpy.exp Element-wise math | 670 | 36 | 0.46 µs | 0.35 µs 1.3x faster | 3.79 µs 8.2x slower |
| numpy.log Element-wise math | 815 | 81 | 0.46 µs | 0.36 µs 1.3x faster | 3.69 µs 8.0x slower |
| numpy.sqrt Element-wise math | 1,362 | 90 | 0.43 µs | 0.29 µs 1.5x faster | 3.41 µs 7.9x slower |
| numpy.clip Element-wise math | 302 | 25 | 2.35 µs | 0.25 µs 9.4x faster | 8.39 µs 3.6x slower |
| Generator.normal Random sampling | -- | -- | 1.02 µs | 0.80 µs 1.3x faster | 17.7 µs 17.4x slower |
| Generator.uniform Random sampling | -- | -- | 1.94 µs | 0.75 µs 2.6x faster | 17.5 µs 9.0x slower |
| Generator.choice Random sampling | -- | -- | 10.6 µs | 0.31 µs 34.2x faster | 13.6 µs 1.3x slower |
| Generator.permutation Random sampling | -- | -- | 1.75 µs | 0.25 µs 7.0x faster | 3.96 µs 2.3x slower |
| scipy.optimize.minimize Optimization | 28 | 10 | 979 µs | 32.7 µs 29.9x faster | 34.2 µs 28.6x faster |
| scipy.optimize.least_squares Optimization | 6 | 0 | 381 µs | 17.2 µs 22.2x faster | 117 µs 3.3x faster |
| scipy.sparse.csr_matrix Sparse matrices | 19 | 3 | 58.0 µs | 1.56 µs 37.2x faster | 9.60 µs 6.0x faster |
| scipy.sparse.csc_matrix Sparse matrices | 9 | 1 | 57.5 µs | 1.55 µs 37.1x faster | 9.69 µs 5.9x faster |
| scipy.sparse.hstack Sparse matrices | 17 | 13 | 91.4 µs | 1.38 µs 66.2x faster | 11.5 µs 7.9x faster |
| scipy.linalg.svd Linear algebra | 21 | 15 | 29.4 µs | 6.00 µs 4.9x faster | 15.8 µs 1.9x faster |
| scipy.linalg.eigh Linear algebra | 24 | 11 | 34.4 µs | 3.11 µs 11.1x faster | 9.96 µs 3.5x faster |
| scipy.linalg.cholesky Linear algebra | 11 | 4 | 9.43 µs | 0.79 µs 11.9x faster | 4.89 µs 1.9x faster |
| scipy.linalg.solve Linear algebra | 17 | 9 | 40.6 µs | 1.29 µs 31.5x faster | 5.80 µs 7.0x faster |
| scipy.linalg.lstsq Linear algebra | 10 | 3 | 44.6 µs | 5.69 µs 7.8x faster | 16.2 µs 2.8x faster |
| scipy.sparse.linalg.svds Linear algebra | 7 | 3 | 500 µs | 8.62 µs 58.0x faster | 15.5 µs 32.3x faster |
| scipy.spatial.distance.cdist Distances and neighbours | 26 | 5 | 4.08 µs | 1.15 µs 3.5x faster | 5.48 µs 1.3x slower |
| scipy.spatial.distance.pdist Distances and neighbours | 25 | 6 | 14.8 µs | 0.81 µs 18.3x faster | 4.53 µs 3.3x faster |
| scipy.spatial.cKDTree Distances and neighbours | 14 | 0 | 12.9 µs | 1.80 µs 7.2x faster | 9.44 µs 1.4x faster |
| scipy.special.expit Special functions | 10 | 6 | 0.42 µs | 0.59 µs 1.4x slower | 4.40 µs 10.5x slower |
| scipy.special.softmax Special functions | 0 | 0 | 10.8 µs | 1.08 µs 10.0x faster | 4.98 µs 2.2x faster |
| scipy.special.logsumexp Special functions | 22 | 1 | 108 µs | 1.06 µs 102x faster | 4.58 µs 23.6x faster |
| scipy.stats.norm.pdf Distributions | -- | -- | 57.2 µs | 1.11 µs 51.5x faster | 5.03 µs 11.4x faster |
| scipy.stats.norm.logpdf Distributions | -- | -- | 60.5 µs | 1.01 µs 59.9x faster | 4.81 µs 12.6x faster |
| scipy.stats.norm.rvs Distributions | -- | -- | 32.0 µs | 1.19 µs 26.9x faster | 17.5 µs 1.8x faster |
The weights are static call sites in library code, not run time, and say nothing about how much time a program
spends in each function. Method calls (x.sum(), rng.normal()) cannot be attributed statically, so the random
Generator methods and the distribution methods (norm.pdf, norm.logpdf, norm.rvs) have no weight: their rows
are unweighted, the mean over their functions, and "all" covers the weighted categories only. Generator.choice is
available on both backends. "Faster on" is the share of the weighted calls that go to functions where Tessero's
per-call time is below NumPy/SciPy's.
In the scikit-learn special row one function carries most of the time: logsumexp, 1 of the 7 calls, takes 108 us
in SciPy against 1.06 us through the extension. The other 6 calls go to expit, which is slower in Tessero (0.42 us
in SciPy, 0.59 us through the extension, 4.40 us through FFI), so the row's weighted time is lower while Tessero is
faster on only 14% of its calls.
The per-call optimize rows solve small problems end to end (two parameters); minimize and least_squares are
Tessero's PHP code, the same on both backends. The cKDTree row builds a tree over 8 points (Tessero's KDTree).
In the model-type mixes, each model type's functions are those of the usual scikit-learn estimators of that kind.
At realistic sizes the inputs come from the same PCG64 streams on both sides, and svds takes the dense matrix on
both. Large dense linear algebra runs in OpenBLAS and LAPACK on both sides and is on a par, except the full svd
(1.1 to 1.2x). pdist and cdist take about 1.5x SciPy's time. The logistic regression minimizes the mean log-loss
with its gradient, both evaluated with array operations each iteration. With L-BFGS-B both sides stop by their
convergence tests (25 iterations in Tessero at a loss of 6.2e-5, 26 in SciPy at 1.9e-5); Tessero's extra time is in
evaluating the objective and the gradient from PHP. Newton-CG and TNC now run SciPy's algorithms step for step
(Newton-CG as SciPy's code, with its line search; TNC as a port of the C code SciPy wraps): TNC stops after 12
iterations on both sides at a loss of 8.0e-5, Newton-CG after 17 iterations in Tessero (9.9e-5) and 18 in SciPy
(6.1e-5). On this separable problem Newton-CG's end point depends on the last bits of the gradient: SciPy itself
stops after 15 iterations at 2.3e-4 when its gradient multiplies by a transposed copy of the matrix instead of the
transposed view. On objectives that round the same way in PHP and Python, both methods return exactly SciPy's
iterates and results. TNC takes 2.3 to 2.6x SciPy's time, for the same reason as L-BFGS-B; Newton-CG is on a par.
Conditions: timed on 2026-11-15 (08:39 to 08:47 UTC) at commit 56102533, after the sweep: four alternating rounds of
FFI, the extension and NumPy/SciPy for bench/ml_bench.php and bench/ml_bench.py, single-threaded
(OPENBLAS_NUM_THREADS=1), at a load average of 5 to 13; each case keeps its best time on each side. The other
per-call rows are the sweep's. The Newton-CG and TNC rows were timed again after their ports (14:40 to 14:42 UTC,
the same data and library, three alternating rounds, load 7 to 8).
Heavy workloads, to scale
88 calls at realistic sizes. Tessero is clearly faster (by more than 10%) on 49, within 10% either way on 24, and clearly slower on 15: well ahead on optimizers, ODE solvers and splines, and behind where it does not yet use the best available algorithm. The axis is logarithmic: each gridline is ten times the last.
Every workload as a table
| Workload | Tessero ms | NumPy/SciPy ms | Ratio | Result |
|---|---|---|---|---|
| scipy.interpolate make_interp_spline k=3, 1M points | 78.7 | 1,550 | 0.05 | 19.7x faster |
| scipy.sparse.csgraph connected_components 500 nodes | 0.4 | 4.37 | 0.09 | 10.9x faster |
| scipy.integrate solve_ivp Lotka-Volterra RK45 | 0.727 | 6.22 | 0.12 | 8.6x faster |
| scipy.optimize least_squares Rosenbrock residuals | 0.764 | 5.81 | 0.13 | 7.6x faster |
| scipy.optimize minimize Nelder-Mead rosen n=5 | 0.884 | 6.39 | 0.14 | 7.2x faster |
| scipy.signal welch 1M, nperseg 1024 | 17.6 | 116 | 0.15 | 6.6x faster |
| scipy.signal detrend 1M | 9.98 | 43.3 | 0.23 | 4.3x faster |
| scipy.ndimage zoom 500x500 x2 (old code; see Fixed after the sweep) | 21 | 76.6 | 0.27 | 3.6x faster |
| scipy.optimize minimize L-BFGS-B rosen n=50 | 25.3 | 88.2 | 0.29 | 3.5x faster |
| scipy.sparse.linalg spsolve tridiagonal 100k | 12 | 39.1 | 0.31 | 3.3x faster |
| scipy.ndimage maximum_filter 1000x1000, 5 | 6.18 | 19.7 | 0.31 | 3.2x faster |
| scipy.stats spearmanr 100k | 8.5 | 22.2 | 0.38 | 2.6x faster |
| numpy unique 1M (1000 values) | 3.62 | 9.11 | 0.40 | 2.5x faster |
| numpy trapezoid 1M | 1.43 | 3.42 | 0.42 | 2.4x faster |
| scipy.ndimage sobel 1000x1000 | 3.93 | 8.87 | 0.44 | 2.3x faster |
| scipy.stats binned_statistic 1M, 100 bins | 25.5 | 54.8 | 0.46 | 2.1x faster |
| scipy.spatial ConvexHull 10k (2-D), array input | 0.639 | 1.34 | 0.48 | 2.1x faster |
| scipy.signal savgol_filter 1M (31, 3) | 8.08 | 16.7 | 0.48 | 2.1x faster |
| scipy.optimize root (2 equations) | 0.0185 | 0.0372 | 0.50 | 2.0x faster |
| scipy.stats rankdata 1M | 77 | 146 | 0.53 | 1.9x faster |
| numpy cumsum 1M | 1.36 | 2.51 | 0.54 | 1.8x faster |
| scipy.linalg solve_triangular 1000x1000 | 0.368 | 0.667 | 0.55 | 1.8x faster |
| numpy polyfit deg 5, 100k | 7.95 | 14.2 | 0.56 | 1.8x faster |
| numpy histogram 1M, 100 bins | 7.15 | 12.6 | 0.57 | 1.8x faster |
| numpy percentile 1M | 5.57 | 9.66 | 0.58 | 1.7x faster |
| scipy.signal convolve2d 500x500 * 5x5 | 8.92 | 15.2 | 0.59 | 1.7x faster |
| scipy.signal decimate 1M by 10 | 12.8 | 21 | 0.61 | 1.6x faster |
| scipy.ndimage distance_transform_edt 512x512 | 11.3 | 17.4 | 0.65 | 1.5x faster |
| numpy argsort 1M | 45.4 | 68.1 | 0.67 | 1.5x faster |
| scipy.ndimage laplace 1000x1000 | 7.68 | 11.3 | 0.68 | 1.5x faster |
| scipy.ndimage median_filter 512x512, 3 | 23 | 33.8 | 0.68 | 1.5x faster |
| scipy.stats skew 1M | 9.58 | 14 | 0.69 | 1.5x faster |
| scipy.signal resample 100k -> 50k | 1.68 | 2.37 | 0.71 | 1.4x faster |
| scipy.stats kurtosis 1M | 9.17 | 12.7 | 0.72 | 1.4x faster |
| scipy.signal filtfilt order 4, 1M | 8.64 | 11.8 | 0.74 | 1.4x faster |
| scipy.signal correlate 10k * 101 | 0.245 | 0.33 | 0.74 | 1.3x faster |
| scipy.signal resample_poly 1M, 3/2 | 30.2 | 40.2 | 0.75 | 1.3x faster |
| numpy searchsorted 1M into 100k | 109 | 141 | 0.77 | 1.3x faster |
| scipy.interpolate PchipInterpolator 10k knots, 1M points | 75.4 | 92.7 | 0.81 | 1.2x faster |
| scipy.stats mannwhitneyu 100k vs 100k | 20.1 | 24.7 | 0.81 | 1.2x faster |
| numpy einsum ij,jk->ik 300x300 | 6.24 | 7.38 | 0.85 | 1.2x faster |
| scipy.ndimage label 1000x1000 | 5.53 | 6.48 | 0.85 | 1.2x faster |
| scipy.interpolate CubicSpline 10k knots, 1M points | 78.4 | 91.1 | 0.86 | 1.2x faster |
| numpy fft2 1024x1024 | 27.3 | 31.7 | 0.86 | 1.2x faster |
| scipy.signal sosfilt order 8, 1M | 8.49 | 9.75 | 0.87 | 1.1x faster |
| scipy.sparse.csgraph minimum_spanning_tree 500 nodes | 5.5 | 6.3 | 0.87 | 1.1x faster |
| scipy.stats gaussian_kde 1000 points, 1000 evaluations | 9.75 | 11.1 | 0.88 | 1.1x faster |
| scipy.spatial Delaunay 10k (2-D) | 27.6 | 31.2 | 0.88 | 1.1x faster |
| scipy.stats kendalltau 10k | 1.53 | 1.72 | 0.89 | 1.1x faster |
| scipy.signal find_peaks 1M | 3.92 | 4.34 | 0.90 | on par |
| scipy.stats linregress 1M | 10.9 | 11.9 | 0.91 | on par |
| scipy.sparse.linalg cg 2-D Poisson 100x100 | 20.1 | 21.8 | 0.92 | on par |
| scipy.integrate quad sin(x) exp(-x) on [0, 10] | 0.00511 | 0.00553 | 0.92 | on par |
| scipy.stats ks_2samp 100k vs 100k | 65.3 | 70.3 | 0.93 | on par |
| numpy linalg slogdet 600x600 | 5.54 | 5.9 | 0.94 | on par |
| scipy.interpolate RBFInterpolator 500 -> 10k (2-D) | 70.6 | 73.6 | 0.96 | on par |
| scipy.linalg svdvals 300x300 | 8.88 | 9.25 | 0.96 | on par |
| numpy cov 50 x 100k | 32.4 | 33.5 | 0.97 | on par |
| scipy.linalg lstsq 1000x100 | 5.4 | 5.58 | 0.97 | on par |
| scipy.linalg pinv 300x300 | 23.9 | 24.6 | 0.97 | on par |
| numpy convolve 100k * 101 | 2.46 | 2.53 | 0.97 | on par |
| scipy.linalg qr 500x500 | 16.2 | 16.4 | 0.99 | on par |
| scipy.cluster.hierarchy linkage ward 2000x3 | 62 | 62.4 | 0.99 | on par |
| scipy.linalg schur 300x300 | 56 | 56.1 | 1.00 | on par |
| scipy.fft dct 1M | 22.2 | 22 | 1.01 | on par |
| scipy.spatial KDTree build 100k (3-D), array input | 30.8 | 30.4 | 1.01 | on par |
| scipy.sparse.linalg eigsh k=6, 2-D Poisson 100x100 | 443 | 436 | 1.02 | on par |
| numpy interp 1M into 1000 | 59.3 | 58.2 | 1.02 | on par |
| scipy.linalg eig 300x300 (general) | 61.6 | 60.4 | 1.02 | on par |
| scipy.linalg cholesky 1000x1000 | 14.2 | 13.8 | 1.03 | on par |
| scipy.stats norm.ppf 1M | 45 | 43.5 | 1.04 | on par |
| scipy.cluster.vq kmeans2 10k x 3, k=8 | 4.22 | 3.99 | 1.06 | on par |
| scipy.spatial ConvexHull 10k (2-D) | 1.52 | 1.41 | 1.08 | on par |
| scipy.signal medfilt 100k, k=5 | 2.63 | 2.34 | 1.12 | 1.1x slower |
| numpy diff 1M | 1.38 | 1.22 | 1.14 | 1.1x slower |
| numpy clip 1M | 1.43 | 1.25 | 1.14 | 1.1x slower |
| scipy.sparse.csgraph shortest_path 500 nodes (Dijkstra) | 70 | 60.3 | 1.16 | 1.2x slower |
| numpy median 1M | 10.7 | 8.63 | 1.24 | 1.2x slower |
| scipy.spatial KDTree query 100 points, k=5, array input | 0.254 | 0.202 | 1.25 | 1.3x slower |
| scipy.spatial KDTree query 100 points, k=5 | 0.268 | 0.207 | 1.29 | 1.3x slower |
| scipy.ndimage rotate 512x512, 30 deg (old code; see Fixed after the sweep) | 49.7 | 35.3 | 1.41 | 1.4x slower |
| scipy.ndimage binary_erosion 1000x1000 | 13.8 | 9.79 | 1.41 | 1.4x slower |
| scipy.signal hilbert 1M | 86.8 | 58.3 | 1.49 | 1.5x slower |
| scipy.ndimage map_coordinates 1000x1000, 100k points (old code; see Fixed after the sweep) | 54.8 | 36.4 | 1.50 | 1.5x slower |
| numpy rfft2 1024x1024 | 15.9 | 9.86 | 1.61 | 1.6x slower |
| scipy.spatial KDTree build 100k (3-D) | 55.4 | 30.7 | 1.80 | 1.8x slower |
| scipy.optimize curve_fit exp decay, 1000 points, array model | 1.36 | 0.59 | 2.31 | 2.3x slower |
| scipy.optimize curve_fit exp decay, 1000 points | 2.25 | 0.584 | 3.85 | 3.9x slower |
Where NumPy and SciPy still lead
- NumPy's own core functions are about 1.6x faster per call than Tessero through the FFI package; Tessero is faster on 65 of 193. Through the native extension the result reverses: Tessero is faster on 159 of 193 (ratio 0.29).
- Heavy workloads: Tessero is faster on 64 of 88 and ahead overall by a modest margin (geometric mean ratio 0.70), and clearly slower on 15. The widest losses are scipy.optimize curve_fit exp decay, 1000 points (3.9x slower), scipy.optimize curve_fit exp decay, 1000 points, array model (2.3x) and scipy.spatial KDTree build 100k (3-D) (1.8x); every case is in the table above. The gaps profiled so far, with their causes, are below.
- Large element-wise inputs: on 212 special functions at 100,000 values each, the two are on a par (ratio 0.94); Tessero is faster on 103.
| Profiled gaps | Tessero | SciPy | Cause | Remedy |
|---|---|---|---|---|
| optimize.curve_fit, 1000 points | 2.29 ms; 1.16 ms with a model that takes the whole array | 0.60 ms | a per-point PHP model is called once per point and evaluation. A whole-array model is called once per evaluation, as SciPy calls it; since this sweep the Jacobian's evaluations go to it in one call laid out along the data axis, and lmdif takes them as one array, with the same results. Through the extension, with the extension's arrays, the fit takes 0.44 ms against SciPy's 0.56 ms (best of 200 fits, three runs each side). The time left through FFI is its cost per array operation (about 5 us, some 60 operations per fit) | the native extension |
| spatial.KDTree build, 100k points from PHP rows | 55.4 ms | 30.7 ms | casting the PHP point rows into one block through FFI; from an NDArray the build takes 30.8 ms, on a par | pass an NDArray |
| numpy.fft.rfft2 1024^2 | 15.4 ms | 11.9 ms | the transforms themselves: timed alone after the sweep, the real FFT of the rows took 10.3 ms against 3.6 ms and the complex FFT down the columns 10.0 ms against 5.4 ms (at a load average near 12) | -- |
| ndimage.binary_erosion 1000^2 | 12.3 ms | 9.7 ms | not yet profiled | -- |
| spatial.KDTree, 100 queries (k=5) in 100k | 0.250 ms; 0.232 ms from an NDArray | 0.207 ms; 0.202 ms | not yet profiled | -- |
| ndimage.map_coordinates 1000^2, 100k points | 41.7 ms | 36.0 ms | the interpolation of the points, now SciPy's own operations (see "Fixed after the sweep"; 54.8 ms in the sweep, with the old code); not yet profiled again | -- |
| signal.hilbert 1M | 73.5 ms | 66.4 ms | the FFT itself, after the input is read in place; in the sweep 86.8 against 58.3 ms, most of which was load | -- |
Where SciPy stopped and Tessero finished
On the special-function test inputs, SciPy crashed, aborted or ran for hours on 21 functions where Tessero returned results. There is no reference output for these inputs, so this is a statement about finishing, not about accuracy.
mathieu_cem
mathieu_sem
mathieu_modcem1
mathieu_modcem2
mathieu_modsem1
mathieu_modsem2
pro_ang1
pro_ang1_cv
pro_cv
pro_rad1
pro_rad1_cv
pro_rad2
pro_rad2_cv
obl_ang1
obl_ang1_cv
obl_cv
obl_rad1
obl_rad1_cv
obl_rad2
obl_rad2_cv
nctdtrinc
Fixed in this round
The first table lists slow spots the sweep turned up and fixed on the spot. The second compares the previous timings with this sweep's, after the latest fixes. Every change was checked again by the parity suite.
| Function | Before | After |
|---|---|---|
| scipy.fft dct / idct / dst / idst (and the n-D forms) | 1M points: about 5 hours (estimated from 8,000 points: 1.1 s) | 50 ms (SciPy 17-30 ms); agrees with SciPy to 1e-16 of the output scale |
| interpolate.CubicSpline, make_interp_spline (k=3) | 10k knots: 8-17 s and 800 MB | 76 ms, O(n) memory (LAPACK dgbsv, as SciPy) |
| sparse.linalg.lsmr | 15 s on a 10 x 6 system | 16 us |
| signal.butter, cheby1, cheby2, ellip, bessel, iirfilter | wrong format, no error | refused with a clear error (convert with tf2sos) |
| np.modf, npoly polymulx and the derivatives, csgraph.laplacian, slinalg.invpascal | -- | match; the parity comparator now checks the sign of real zeros |
| Case | Before | After | NumPy/SciPy |
|---|---|---|---|
| integrate.quad sin(x) exp(-x) on [0, 10] | 0.0187 ms | 0.0051 ms | 0.0055 ms |
| optimize.curve_fit, 1000 points | 5.03 ms | 2.25 ms; 1.36 ms with a model that takes the whole array | 0.58 ms |
| sparse.linalg.eigsh k=6, 100 x 100 grid Poisson (CSR) | 743 ms | 443 ms | 436 ms |
| linalg.cholesky 1000x1000 | 20.6 ms | 14.2 ms | 13.8 ms |
| numpy.linalg.slogdet 600x600 | 7.27 ms | 5.54 ms | 5.90 ms |
| spatial.KDTree build, 100k points | 58.1 ms | 55.4 ms from PHP rows; 30.8 ms from an NDArray | 30.7 ms |
| spatial.KDTree, 100 queries (k=5) in 100k | 0.363 ms | 0.268 ms; 0.254 ms from an NDArray | 0.207 ms |
| spatial.ConvexHull, 10k (2-D) | 1.69 ms | 1.52 ms from PHP rows; 0.64 ms from an NDArray | 1.41 ms |
| special.kelvin_zeros, ber_zeros, jn_zeros (tier 3: their fixture calls, per call through the extension) | 15,595; 1,826; 520 us | 98; 12.3; 124 us | 98; 12.5; 132 us |
| small calls through the native extension (tier 3, per call) | bitwise_and 2.17; ldexp 2.33; linalg.inv 4.42; linalg.slogdet 2.35; concatenate 2.22 us | 0.83; 0.85; 1.66; 1.13; 1.31 us | 0.65; 0.64; 6.02; 4.20; 1.23 us |
Since the sweep
One change made a case slower: optimize.least_squares (method 'lm', the Rosenbrock residuals) now runs MINPACK's
lmder with SciPy's 2-point differences, as SciPy does, and returns SciPy's results; it takes 0.76 ms
instead of 0.31 ms, against SciPy's 5.8 ms.
After the classical machine learning timing, minimize with method 'TNC' became a port of the TNC code SciPy wraps
(it was Tessero's own truncated Newton, which on the logistic regression ran 800 iterations without converging), and
method 'Newton-CG' follows SciPy's code step for step, its line search included (MINPACK's dcsrch, then
scalar_search_wolfe2); fmin_tnc and fmin_ncg with them. Both now return SciPy's results, which changes their
answers. The logistic regression at 10,000 x 50 (see the classical machine learning section): TNC 5,934 ms through
the extension and 5,423 ms through FFI before, 141 and 156 ms after, against SciPy's 61 ms; Newton-CG 4,382 and
5,318 ms before, 3,307 and 3,614 ms after, against SciPy's 3,544 ms.
Then ndimage.map_coordinates, shift, zoom, affine_transform and rotate were corrected. At the B-spline
orders (2 to 5) they had matched SciPy only in the modes 'mirror' and 'reflect': in 'constant' (SciPy's default,
the mode these cases time), 'nearest' and 'wrap' their results were off by up to 0.2 to 0.4 on data in [0, 1], and
prefilter=False was ignored. They now follow SciPy's code (NI_GeometricTransform, NI_ZoomShift and the
spline prefilter, with its padding at the edges) and give SciPy's answers, in the input's dtype, on 872 of 882
calls checked against SciPy, on both backends (the other 10 are bool results with a cval outside [0, 1], with the
same truth values). The sweep's times for these cases, and the earlier zoom and shift rows of this section, were
of the old code. Re-timed alone on 2026-11-15 (18:42 to 18:47 UTC, the installed library at commit d2d4e2e6, eight
alternating rounds of FFI and SciPy, at a load average of 8 to 14; shift three rounds): rotate 512^2 at 30 deg
49.7 ms in the sweep, now 29.6 ms against SciPy's 36.1 ms; map_coordinates 1000^2 at 100k points 54.8 ms, now
41.7 ms against 36.0 ms; zoom 500^2 x2 21 ms, now 23.6 ms against 74.1 ms; shift 1000^2 at order 3 42.9 ms
against 89.6 ms.
Speed counts only when the answers match
The parity suite checks 1,846 functions against reference outputs generated by NumPy and SciPy; 1,846 pass on the FFI package and 1,846 on the native extension. The per-call timings cover only calls that passed their parity check against NumPy and SciPy reference outputs, and the parity suite runs on both of Tessero's backends, the FFI package and the native extension. See the verified NumPy and SciPy parity and the head-to-head benchmarks.