Performance Benchmarks
Strata is designed from the ground up in Mojo to deliver maximum computational throughput, minimal memory overhead, and seamless SIMD/BLAS hardware acceleration without sacrificing standard Scikit-Learn usability or numerical precision.
1. Summary
Section titled “1. Summary”A comprehensive benchmark comparison was conducted evaluating 53 individual model phases and routines across identical synthetic workloads in Strata (Mojo) and Scikit-Learn (Python / Cython / C / OpenBLAS):
- Total Benchmarks Evaluated: 53
- Overall Geometric Mean Speedup: 1.79x faster in Strata
- Model Inference (
predict/transform) Speedup: 2.15x geometric mean (21 of 24 benchmarks faster) - Model Training (
fit) Speedup: 1.91x geometric mean (20 of 24 benchmarks faster) - Mathematical Parity: 100% exact numerical match (, ; Accuracy , )
2. Benchmark Methodology & Verification
Section titled “2. Benchmark Methodology & Verification”Strict Apples-to-Apples Protocol
Section titled “Strict Apples-to-Apples Protocol”- Identical Datasets & Seeds: Both Strata and Scikit-Learn receive identical deterministically generated synthetic datasets with matching feature distributions, noise scaling, and sample dimensions.
- Timing Isolation: All benchmarks measure only the core execution time using nanosecond monotonic timers (
perf_counter_ns), excluding dataset generation and module import overhead. - Warmup & Multiple Iterations: Each benchmark runs dedicated warmup cycles followed by multiple timed iterations. The median execution time is reported to eliminate OS scheduling noise.
- Hardware Baseline: Single-threaded CPU core execution to measure pure algorithmic and compiler vectorization throughput.
- Simultaneous Quality & Parity Check: Every benchmark verifies model accuracy, score, or cluster inertia against Scikit-Learn’s output to ensure speedups are mathematically valid.
3. Model Training & Fitting Performance (fit)
Section titled “3. Model Training & Fitting Performance (fit)”Category Summary: Geometric Mean Speedup = 1.91x (20 of 24 algorithms faster in Strata)
| Estimator / Component | Workload () | Strata Median | Scikit-Learn Median | Speedup | Strata Throughput | Parity / Metric |
|---|---|---|---|---|---|---|
PolynomialFeatures_d2 |
5,000 x 10 | 82.4 µs | 602.4 µs | 7.31x | 60,709,451 samples/s | Exact Match |
MinMaxScaler |
5,000 x 10 | 151.7 µs | 796.7 µs | 5.25x | 32,964,461 samples/s | Exact Match |
StandardScaler |
5,000 x 10 | 254.6 µs | 1.16 ms | 4.56x | 19,637,376 samples/s | Exact Match |
NearestNeighbors |
2,000 x 10 | 120.9 µs | 516.7 µs | 4.27x | 16,541,024 samples/s | Exact Match |
KNeighborsClassifier |
2,000 x 10 | 176.3 µs | 633.2 µs | 3.59x | 11,345,587 samples/s | Accuracy: 1.0000 (Exact) |
KMeans |
2,000 x 10 | 778.8 µs | 2.49 ms | 3.19x | 2,567,966 samples/s | Exact Inertia Match |
ElasticNet |
2,000 x 10 | 399.7 µs | 983.7 µs | 2.46x | 5,003,596 samples/s | (Exact) |
LinearRegression |
2,000 x 10 | 428.0 µs | 1.04 ms | 2.44x | 4,672,619 samples/s | (Exact) |
TruncatedSVD_CSR |
2,000 x 10 | 1.31 ms | 3.15 ms | 2.41x | 1,526,846 samples/s | Exact Match |
SGDClassifier |
2,000 x 10 | 946.7 µs | 2.25 ms | 2.38x | 2,112,668 samples/s | Accuracy: 1.0000 (Exact) |
DecisionTreeClassifier |
2,000 x 10 | 2.11 ms | 4.75 ms | 2.25x | 946,393 samples/s | Accuracy: 1.0000 (Exact) |
RandomForestRegressor |
2,000 x 10 | 113.26 ms | 230.05 ms | 2.03x | 17,658 samples/s | vs |
KNeighborsRegressor |
2,000 x 10 | 162.1 µs | 328.8 µs | 2.03x | 12,337,454 samples/s | vs |
MiniBatchKMeans |
2,000 x 10 | 3.76 ms | 6.52 ms | 1.74x | 532,605 samples/s | Exact Inertia Match |
Lasso |
2,000 x 10 | 379.0 µs | 655.7 µs | 1.73x | 5,276,641 samples/s | (Exact) |
Ridge |
2,000 x 10 | 474.4 µs | 808.6 µs | 1.70x | 4,215,478 samples/s | (Exact) |
RandomForestClassifier |
2,000 x 10 | 23.28 ms | 35.02 ms | 1.50x | 85,927 samples/s | Accuracy: 1.0000 (Exact) |
DecisionTreeRegressor |
2,000 x 10 | 14.60 ms | 20.53 ms | 1.41x | 136,965 samples/s | vs |
SGDRegressor |
2,000 x 10 | 1.81 ms | 2.37 ms | 1.31x | 1,106,442 samples/s | (Exact) |
RobustScaler |
5,000 x 10 | 4.00 ms | 4.38 ms | 1.09x | 1,248,877 samples/s | Exact Match |
PCA |
2,000 x 10 | 561.7 µs | 545.5 µs | 0.97x | 3,560,743 samples/s | Exact Variance Match |
LogisticRegression |
2,000 x 10 | 9.16 ms | 5.59 ms | 0.61x | 218,342 samples/s | Accuracy: 1.0000 (Exact) |
HistGradientBoostingRegressor |
2,000 x 10 | 106.22 ms | 63.64 ms | 0.60x | 18,829 samples/s | vs |
HistGradientBoostingClassifier |
2,000 x 10 | 77.46 ms | 27.66 ms | 0.36x | 25,820 samples/s | Accuracy: 1.0000 (Exact) |
4. Model Inference & Transformation Throughput (predict, transform, query)
Section titled “4. Model Inference & Transformation Throughput (predict, transform, query)”Category Summary: Geometric Mean Speedup = 2.15x (21 of 24 estimators faster in Strata)
| Estimator / Component | Workload () | Strata Median | Scikit-Learn Median | Speedup | Strata Throughput | Parity / Metric |
|---|---|---|---|---|---|---|
SGDRegressor |
2,000 x 10 | 35.2 µs | 225.3 µs | 6.40x | 56,816,568 samples/s | (Exact) |
LogisticRegression |
2,000 x 10 | 90.3 µs | 524.8 µs | 5.81x | 22,143,858 samples/s | Accuracy: 1.0000 (Exact) |
DecisionTreeClassifier |
2,000 x 10 | 53.9 µs | 296.6 µs | 5.50x | 37,097,836 samples/s | Accuracy: 1.0000 (Exact) |
DecisionTreeRegressor |
2,000 x 10 | 219.9 µs | 1.01 ms | 4.60x | 9,096,015 samples/s | vs |
ElasticNet |
2,000 x 10 | 44.2 µs | 185.6 µs | 4.20x | 45,235,564 samples/s | (Exact) |
RobustScaler |
5,000 x 10 | 129.5 µs | 506.2 µs | 3.91x | 38,604,971 samples/s | Exact Match |
Lasso |
2,000 x 10 | 39.0 µs | 137.2 µs | 3.52x | 51,297,835 samples/s | (Exact) |
LinearRegression |
2,000 x 10 | 52.9 µs | 146.6 µs | 2.77x | 37,836,866 samples/s | (Exact) |
StandardScaler |
5,000 x 10 | 125.0 µs | 330.5 µs | 2.64x | 40,010,083 samples/s | Exact Match |
Ridge |
2,000 x 10 | 50.5 µs | 131.6 µs | 2.61x | 39,608,666 samples/s | (Exact) |
MinMaxScaler |
5,000 x 10 | 122.8 µs | 292.5 µs | 2.38x | 40,718,270 samples/s | Exact Match |
SGDClassifier |
2,000 x 10 | 100.5 µs | 226.8 µs | 2.26x | 19,897,924 samples/s | Accuracy: 1.0000 (Exact) |
MiniBatchKMeans |
2,000 x 10 | 135.4 µs | 279.8 µs | 2.07x | 14,769,576 samples/s | Exact Inertia Match |
HistGradientBoostingRegressor |
2,000 x 10 | 2.81 ms | 5.53 ms | 1.96x | 710,571 samples/s | vs |
KMeans |
2,000 x 10 | 140.3 µs | 268.6 µs | 1.91x | 14,252,374 samples/s | Exact Inertia Match |
KNeighborsClassifier |
500 x 10 | 4.34 ms | 6.75 ms | 1.55x | 115,113 samples/s | Accuracy: 1.0000 (Exact) |
KNeighborsRegressor |
500 x 10 | 4.31 ms | 5.95 ms | 1.38x | 115,939 samples/s | vs |
NearestNeighbors |
500 x 10 | 4.21 ms | 5.58 ms | 1.33x | 118,814 samples/s | Exact Match |
RandomForestRegressor |
2,000 x 10 | 6.75 ms | 8.24 ms | 1.22x | 296,321 samples/s | vs |
HistGradientBoostingClassifier |
2,000 x 10 | 2.64 ms | 3.10 ms | 1.18x | 758,034 samples/s | Accuracy: 1.0000 (Exact) |
PolynomialFeatures_d2 |
5,000 x 10 | 2.26 ms | 2.37 ms | 1.05x | 2,214,936 samples/s | Exact Match |
RandomForestClassifier |
2,000 x 10 | 2.03 ms | 1.74 ms | 0.86x | 986,470 samples/s | Accuracy: 1.0000 (Exact) |
TruncatedSVD_CSR |
2,000 x 10 | 336.8 µs | 274.4 µs | 0.81x | 5,939,124 samples/s | Exact Match |
PCA |
2,000 x 10 | 219.0 µs | 166.5 µs | 0.76x | 9,130,356 samples/s | Exact Variance Match |
5. Linear Algebra & Matrix Multiplication Kernels
Section titled “5. Linear Algebra & Matrix Multiplication Kernels”| Kernel / Operation | Dimensions | Strata Median | NumPy / SciPy Median | Speedup | Strata Throughput | Parity |
|---|---|---|---|---|---|---|
Dense_Dot_Vec |
10,000 x 50 | 81.9 µs | 113.1 µs | 1.38x | 122,088,197 samples/s | Exact Match |
Dense_GEMM (Matrix Multiply) |
256 x 256 | 1.37 ms | 1.41 ms | 1.03x (Parity) | 187,083 samples/s | Exact Match |
Sparse_SpGEMM |
2,000 x 2,000 | 3.89 ms | 1.65 ms | 0.42x | 514,775 samples/s | Exact Match |
Sparse_SpMM |
2,000 x 64 | 4.08 ms | 1.13 ms | 0.28x | 489,933 samples/s | Exact Match |
Sparse_SpMV |
10,000 x 10,000 | 1.08 ms | 273.1 µs | 0.25x | 9,266,999 samples/s | Exact Match |
6. Key Architectural Drivers of Strata’s Speed
Section titled “6. Key Architectural Drivers of Strata’s Speed”1. Compile-Time SIMD & FMA Inlining
Section titled “1. Compile-Time SIMD & FMA Inlining”Mojo compiles vector arithmetic directly to AVX2 / AVX-512 / ARM NEON instructions with zero interpreter dispatch overhead. In transformers like StandardScaler and MinMaxScaler, vector math operates directly on L1-cached pointers.
2. Contiguous Value Structs & Flat Memory Models
Section titled “2. Contiguous Value Structs & Flat Memory Models”In Decision Trees and Random Forests, tree nodes are stored in contiguous List[TreeNode] buffers rather than Python object heaps. Traversal consists of simple direct pointer offsets and register comparisons, yielding 5.5x faster decision tree inference.
3. Hardware CBLAS & LAPACK Acceleration
Section titled “3. Hardware CBLAS & LAPACK Acceleration”For heavy matrix factorizations and nearest neighbor distance matrices, Strata interfaces directly with native CBLAS (cblas_dgemm/cblas_sgemm) and LAPACK (dgesvd_, dpotrf_), achieving 100% parity with OpenBLAS assembly.
7. Running the Benchmark Suite Locally
Section titled “7. Running the Benchmark Suite Locally”You can reproduce all benchmarks on your machine using the built-in benchmarking runner:
# Run all benchmark suites with default parameterspixi run benchmark
# Run a quick verification sweep across all modelspixi run benchmark-quick
# Run specific domain suitespixi run benchmark-treespixi run benchmark-linearpixi run benchmark-clusteringpixi run benchmark-neighborspixi run benchmark-preprocessingpixi run benchmark-linalg