From 7736effc27ac5c42e910f9794cf121cf57c43153 Mon Sep 17 00:00:00 2001 From: Pratik Bhadane Date: Tue, 24 Mar 2026 02:49:29 +0530 Subject: [PATCH] fix(bench): adjust feature_matrix speedup floor to 0.40 for cross-architecture compatibility --- perf-contract/batch.json | 71 +++++++ perf-contract/indicator_latency.json | 163 +++++++++++++++ perf-contract/manifest.json | 52 +++++ perf-contract/runtime_hotspots.json | 96 +++++++++ perf-contract/simd.json | 285 +++++++++++++++++++++++++++ perf-contract/streaming.json | 73 +++++++ 6 files changed, 740 insertions(+) create mode 100644 perf-contract/batch.json create mode 100644 perf-contract/indicator_latency.json create mode 100644 perf-contract/manifest.json create mode 100644 perf-contract/runtime_hotspots.json create mode 100644 perf-contract/simd.json create mode 100644 perf-contract/streaming.json diff --git a/perf-contract/batch.json b/perf-contract/batch.json new file mode 100644 index 0000000..fc110d9 --- /dev/null +++ b/perf-contract/batch.json @@ -0,0 +1,71 @@ +{ + "metadata": { + "suite": "batch", + "runtime": { + "generated_at_utc": "2026-03-23T21:08:30.877702+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "dataset": { + "n_samples": 20000, + "n_series": 32, + "total_bars": 640000, + "seed": 42 + } + }, + "results": [ + { + "indicator": "SMA", + "parallel_ms": 1.9615, + "sequential_ms": 2.0423, + "loop_ms": 0.8865, + "parallel_speedup_vs_loop": 0.452, + "sequential_speedup_vs_loop": 0.4341 + }, + { + "indicator": "RSI", + "parallel_ms": 2.1731, + "sequential_ms": 4.3225, + "loop_ms": 3.2043, + "parallel_speedup_vs_loop": 1.4745, + "sequential_speedup_vs_loop": 0.7413 + }, + { + "indicator": "ATR", + "parallel_ms": 4.2249, + "sequential_ms": 6.6175, + "loop_ms": 4.0382, + "parallel_speedup_vs_loop": 0.9558, + "sequential_speedup_vs_loop": 0.6102 + }, + { + "indicator": "ADX", + "parallel_ms": 4.8674, + "sequential_ms": 7.6402, + "loop_ms": 5.1861, + "parallel_speedup_vs_loop": 1.0655, + "sequential_speedup_vs_loop": 0.6788 + } + ], + "grouped_results": [ + { + "case": "close_bundle_3", + "grouped_ms": 0.1878, + "separate_ms": 0.1719, + "speedup_vs_separate": 0.9155 + }, + { + "case": "hlc_bundle_3", + "grouped_ms": 0.2958, + "separate_ms": 0.4633, + "speedup_vs_separate": 1.5666 + } + ] +} \ No newline at end of file diff --git a/perf-contract/indicator_latency.json b/perf-contract/indicator_latency.json new file mode 100644 index 0000000..3be2e9f --- /dev/null +++ b/perf-contract/indicator_latency.json @@ -0,0 +1,163 @@ +{ + "metadata": { + "suite": "indicator_latency", + "runtime": { + "generated_at_utc": "2026-03-23T21:08:30.515962+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "fixtures": [ + { + "path": "/Users/pratikbhadane/Work/Projects/ferro-ta/benchmarks/fixtures/canonical_ohlcv.npz", + "size_bytes": 75586, + "sha256": "60192f8349fb06cd59ef7f70fd77aa8280399e819d7cc5eed3ca95cf5ee1a89c" + } + ], + "dataset": { + "fixture": "/Users/pratikbhadane/Work/Projects/ferro-ta/benchmarks/fixtures/canonical_ohlcv.npz", + "bars": 2000, + "rounds": 5 + } + }, + "results": [ + { + "name": "VAR_20", + "inputs": "close", + "kwargs": { + "timeperiod": 20 + }, + "elapsed_ms": 0.0202 + }, + { + "name": "WILLR_14", + "inputs": "hlc", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0183 + }, + { + "name": "STOCH", + "inputs": "hlc", + "kwargs": {}, + "elapsed_ms": 0.0181 + }, + { + "name": "ADX_14", + "inputs": "hlc", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0147 + }, + { + "name": "CCI_14", + "inputs": "hlc", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0144 + }, + { + "name": "MACD", + "inputs": "close", + "kwargs": {}, + "elapsed_ms": 0.0132 + }, + { + "name": "ATR_14", + "inputs": "hlc", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0108 + }, + { + "name": "RSI_14", + "inputs": "close", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0102 + }, + { + "name": "STDDEV_20", + "inputs": "close", + "kwargs": { + "timeperiod": 20 + }, + "elapsed_ms": 0.0086 + }, + { + "name": "BETA_5", + "inputs": "pair_hl", + "kwargs": { + "timeperiod": 5 + }, + "elapsed_ms": 0.008 + }, + { + "name": "CORREL_30", + "inputs": "pair_hl", + "kwargs": { + "timeperiod": 30 + }, + "elapsed_ms": 0.0068 + }, + { + "name": "EMA_20", + "inputs": "close", + "kwargs": { + "timeperiod": 20 + }, + "elapsed_ms": 0.0052 + }, + { + "name": "BBANDS_20", + "inputs": "close", + "kwargs": { + "timeperiod": 20 + }, + "elapsed_ms": 0.005 + }, + { + "name": "TSF_14", + "inputs": "close", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0048 + }, + { + "name": "LINEARREG_14", + "inputs": "close", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0046 + }, + { + "name": "LINEARREG_SLOPE_14", + "inputs": "close", + "kwargs": { + "timeperiod": 14 + }, + "elapsed_ms": 0.0045 + }, + { + "name": "SMA_20", + "inputs": "close", + "kwargs": { + "timeperiod": 20 + }, + "elapsed_ms": 0.0027 + } + ] +} \ No newline at end of file diff --git a/perf-contract/manifest.json b/perf-contract/manifest.json new file mode 100644 index 0000000..39d6e1f --- /dev/null +++ b/perf-contract/manifest.json @@ -0,0 +1,52 @@ +{ + "metadata": { + "suite": "perf_contract", + "runtime": { + "generated_at_utc": "2026-03-23T21:09:13.077731+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "fixtures": [ + { + "path": "/Users/pratikbhadane/Work/Projects/ferro-ta/benchmarks/fixtures/canonical_ohlcv.npz", + "size_bytes": 75586, + "sha256": "60192f8349fb06cd59ef7f70fd77aa8280399e819d7cc5eed3ca95cf5ee1a89c" + } + ], + "output_dir": "perf-contract" + }, + "artifacts": { + "indicator_latency": { + "path": "perf-contract/indicator_latency.json", + "size_bytes": 3212, + "sha256": "1e7f844fe6eb467f07bbb1e4eb918c56861e8cf819ab4802b96e033c6d2570c4" + }, + "batch": { + "path": "perf-contract/batch.json", + "size_bytes": 1679, + "sha256": "202d67b24a88184473f93cec9f866ca34ff60721068e15e7e5d23962f006d169" + }, + "streaming": { + "path": "perf-contract/streaming.json", + "size_bytes": 1939, + "sha256": "04476c3d95a9e7d87e40331b28c5ccad9a7aa5abcfc47fb6ac7e929365f68554" + }, + "runtime_hotspots": { + "path": "perf-contract/runtime_hotspots.json", + "size_bytes": 2365, + "sha256": "d37a58bc88def9f1525b9b0f64f0bd7b9c0df9ed4cae260c833697f6a1689ca8" + }, + "simd": { + "path": "perf-contract/simd.json", + "size_bytes": 7670, + "sha256": "3f9b341a8206698ed172650752d808621c9b5218f42a2373f0f4485496197b4c" + } + } +} \ No newline at end of file diff --git a/perf-contract/runtime_hotspots.json b/perf-contract/runtime_hotspots.json new file mode 100644 index 0000000..92c03cb --- /dev/null +++ b/perf-contract/runtime_hotspots.json @@ -0,0 +1,96 @@ +{ + "metadata": { + "suite": "runtime_hotspots", + "runtime": { + "generated_at_utc": "2026-03-23T21:08:34.436165+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "dataset": { + "price_bars": 20000, + "iv_bars": 50000, + "window": 252 + } + }, + "results": [ + { + "category": "python_analysis", + "name": "iv_zscore", + "fast_ms": 28.857, + "reference_ms": 897.0178, + "speedup_vs_reference": 31.0849, + "share_of_suite_pct": 70.0 + }, + { + "category": "python_analysis", + "name": "iv_rank", + "fast_ms": 10.8496, + "reference_ms": 199.4376, + "speedup_vs_reference": 18.3821, + "share_of_suite_pct": 26.32 + }, + { + "category": "python_analysis", + "name": "iv_percentile", + "fast_ms": 0.9124, + "reference_ms": 79.6557, + "speedup_vs_reference": 87.3019, + "share_of_suite_pct": 2.21 + }, + { + "category": "ffi_grouping", + "name": "feature_matrix", + "fast_ms": 0.2411, + "reference_ms": 0.2215, + "speedup_vs_reference": 0.9186, + "share_of_suite_pct": 0.58 + }, + { + "category": "ffi_grouping", + "name": "compute_many_close", + "fast_ms": 0.1563, + "reference_ms": 0.1498, + "speedup_vs_reference": 0.9587, + "share_of_suite_pct": 0.38 + }, + { + "category": "rust_kernel", + "name": "BETA", + "fast_ms": 0.0694, + "reference_ms": 159.2715, + "speedup_vs_reference": 2294.4163, + "share_of_suite_pct": 0.17 + }, + { + "category": "rust_kernel", + "name": "CORREL", + "fast_ms": 0.0555, + "reference_ms": 158.2775, + "speedup_vs_reference": 2851.8468, + "share_of_suite_pct": 0.13 + }, + { + "category": "rust_kernel", + "name": "LINEARREG", + "fast_ms": 0.0414, + "reference_ms": 44.8111, + "speedup_vs_reference": 1081.9491, + "share_of_suite_pct": 0.1 + }, + { + "category": "rust_kernel", + "name": "TSF", + "fast_ms": 0.0413, + "reference_ms": 46.3799, + "speedup_vs_reference": 1122.1039, + "share_of_suite_pct": 0.1 + } + ] +} \ No newline at end of file diff --git a/perf-contract/simd.json b/perf-contract/simd.json new file mode 100644 index 0000000..098e5cc --- /dev/null +++ b/perf-contract/simd.json @@ -0,0 +1,285 @@ +{ + "metadata": { + "suite": "simd", + "runtime": { + "generated_at_utc": "2026-03-23T21:09:13.028473+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "dataset": { + "price_bars": 20000, + "iv_bars": 50000, + "window": 252 + }, + "variants": [ + "portable_release", + "simd_release" + ] + }, + "results": [ + { + "name": "compute_many_close", + "category": "ffi_grouping", + "portable_ms": 0.1711, + "simd_ms": 0.1618, + "speedup_simd_vs_portable": 1.0575 + }, + { + "name": "iv_percentile", + "category": "python_analysis", + "portable_ms": 0.9126, + "simd_ms": 0.9096, + "speedup_simd_vs_portable": 1.0033 + }, + { + "name": "iv_zscore", + "category": "python_analysis", + "portable_ms": 29.0039, + "simd_ms": 28.9123, + "speedup_simd_vs_portable": 1.0032 + }, + { + "name": "iv_rank", + "category": "python_analysis", + "portable_ms": 10.8629, + "simd_ms": 10.862, + "speedup_simd_vs_portable": 1.0001 + }, + { + "name": "BETA", + "category": "rust_kernel", + "portable_ms": 0.0696, + "simd_ms": 0.0696, + "speedup_simd_vs_portable": 1.0 + }, + { + "name": "CORREL", + "category": "rust_kernel", + "portable_ms": 0.0555, + "simd_ms": 0.0556, + "speedup_simd_vs_portable": 0.9982 + }, + { + "name": "TSF", + "category": "rust_kernel", + "portable_ms": 0.0414, + "simd_ms": 0.0415, + "speedup_simd_vs_portable": 0.9976 + }, + { + "name": "LINEARREG", + "category": "rust_kernel", + "portable_ms": 0.0413, + "simd_ms": 0.0416, + "speedup_simd_vs_portable": 0.9928 + }, + { + "name": "feature_matrix", + "category": "ffi_grouping", + "portable_ms": 0.2543, + "simd_ms": 0.2634, + "speedup_simd_vs_portable": 0.9655 + } + ], + "reports": { + "portable_release": { + "metadata": { + "suite": "runtime_hotspots", + "runtime": { + "generated_at_utc": "2026-03-23T21:08:38.698373+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "dataset": { + "price_bars": 20000, + "iv_bars": 50000, + "window": 252 + } + }, + "results": [ + { + "category": "python_analysis", + "name": "iv_zscore", + "fast_ms": 29.0039, + "reference_ms": 903.5384, + "speedup_vs_reference": 31.1523, + "share_of_suite_pct": 70.04 + }, + { + "category": "python_analysis", + "name": "iv_rank", + "fast_ms": 10.8629, + "reference_ms": 201.621, + "speedup_vs_reference": 18.5606, + "share_of_suite_pct": 26.23 + }, + { + "category": "python_analysis", + "name": "iv_percentile", + "fast_ms": 0.9126, + "reference_ms": 80.0849, + "speedup_vs_reference": 87.7523, + "share_of_suite_pct": 2.2 + }, + { + "category": "ffi_grouping", + "name": "feature_matrix", + "fast_ms": 0.2543, + "reference_ms": 0.2222, + "speedup_vs_reference": 0.874, + "share_of_suite_pct": 0.61 + }, + { + "category": "ffi_grouping", + "name": "compute_many_close", + "fast_ms": 0.1711, + "reference_ms": 0.1413, + "speedup_vs_reference": 0.8257, + "share_of_suite_pct": 0.41 + }, + { + "category": "rust_kernel", + "name": "BETA", + "fast_ms": 0.0696, + "reference_ms": 162.9168, + "speedup_vs_reference": 2341.2971, + "share_of_suite_pct": 0.17 + }, + { + "category": "rust_kernel", + "name": "CORREL", + "fast_ms": 0.0555, + "reference_ms": 163.8589, + "speedup_vs_reference": 2950.1793, + "share_of_suite_pct": 0.13 + }, + { + "category": "rust_kernel", + "name": "TSF", + "fast_ms": 0.0414, + "reference_ms": 49.2846, + "speedup_vs_reference": 1189.9901, + "share_of_suite_pct": 0.1 + }, + { + "category": "rust_kernel", + "name": "LINEARREG", + "fast_ms": 0.0413, + "reference_ms": 47.5241, + "speedup_vs_reference": 1149.7853, + "share_of_suite_pct": 0.1 + } + ] + }, + "simd_release": { + "metadata": { + "suite": "runtime_hotspots", + "runtime": { + "generated_at_utc": "2026-03-23T21:08:57.755423+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "dataset": { + "price_bars": 20000, + "iv_bars": 50000, + "window": 252 + } + }, + "results": [ + { + "category": "python_analysis", + "name": "iv_zscore", + "fast_ms": 28.9123, + "reference_ms": 909.2586, + "speedup_vs_reference": 31.4489, + "share_of_suite_pct": 69.98 + }, + { + "category": "python_analysis", + "name": "iv_rank", + "fast_ms": 10.862, + "reference_ms": 198.2076, + "speedup_vs_reference": 18.2478, + "share_of_suite_pct": 26.29 + }, + { + "category": "python_analysis", + "name": "iv_percentile", + "fast_ms": 0.9096, + "reference_ms": 78.1232, + "speedup_vs_reference": 85.889, + "share_of_suite_pct": 2.2 + }, + { + "category": "ffi_grouping", + "name": "feature_matrix", + "fast_ms": 0.2634, + "reference_ms": 0.2219, + "speedup_vs_reference": 0.8425, + "share_of_suite_pct": 0.64 + }, + { + "category": "ffi_grouping", + "name": "compute_many_close", + "fast_ms": 0.1618, + "reference_ms": 0.155, + "speedup_vs_reference": 0.9583, + "share_of_suite_pct": 0.39 + }, + { + "category": "rust_kernel", + "name": "BETA", + "fast_ms": 0.0696, + "reference_ms": 161.4576, + "speedup_vs_reference": 2320.3601, + "share_of_suite_pct": 0.17 + }, + { + "category": "rust_kernel", + "name": "CORREL", + "fast_ms": 0.0556, + "reference_ms": 162.6189, + "speedup_vs_reference": 2923.4861, + "share_of_suite_pct": 0.13 + }, + { + "category": "rust_kernel", + "name": "LINEARREG", + "fast_ms": 0.0416, + "reference_ms": 48.029, + "speedup_vs_reference": 1155.0143, + "share_of_suite_pct": 0.1 + }, + { + "category": "rust_kernel", + "name": "TSF", + "fast_ms": 0.0415, + "reference_ms": 47.55, + "speedup_vs_reference": 1145.783, + "share_of_suite_pct": 0.1 + } + ] + } + } +} \ No newline at end of file diff --git a/perf-contract/streaming.json b/perf-contract/streaming.json new file mode 100644 index 0000000..92f6471 --- /dev/null +++ b/perf-contract/streaming.json @@ -0,0 +1,73 @@ +{ + "metadata": { + "suite": "streaming", + "runtime": { + "generated_at_utc": "2026-03-23T21:08:30.968886+00:00", + "python_version": "3.12.11", + "platform": "macOS-26.3.1-arm64-arm-64bit", + "machine": "arm64", + "processor": "arm" + }, + "git": { + "commit": "2d5000262f0f1439546bd4872235aae0333880a4", + "dirty": true, + "branch": "feat/performace-1.0.2" + }, + "dataset": { + "n_bars": 20000, + "seed": 2026 + } + }, + "results": [ + { + "indicator": "StreamingSMA", + "inputs": "close", + "stream_total_ms": 0.8808, + "batch_total_ms": 0.0153, + "stream_ns_per_update": 44.04, + "batch_ns_per_bar": 0.77, + "updates_per_second": 22705779.59, + "stream_over_batch_ratio": 57.4469 + }, + { + "indicator": "StreamingEMA", + "inputs": "close", + "stream_total_ms": 0.8611, + "batch_total_ms": 0.0408, + "stream_ns_per_update": 43.06, + "batch_ns_per_bar": 2.04, + "updates_per_second": 23225431.81, + "stream_over_batch_ratio": 21.0884 + }, + { + "indicator": "StreamingRSI", + "inputs": "close", + "stream_total_ms": 0.9235, + "batch_total_ms": 0.0932, + "stream_ns_per_update": 46.17, + "batch_ns_per_bar": 4.66, + "updates_per_second": 21656740.75, + "stream_over_batch_ratio": 9.9035 + }, + { + "indicator": "StreamingATR", + "inputs": "hlc", + "stream_total_ms": 2.0074, + "batch_total_ms": 0.0935, + "stream_ns_per_update": 100.37, + "batch_ns_per_bar": 4.68, + "updates_per_second": 9963056.99, + "stream_over_batch_ratio": 21.4603 + }, + { + "indicator": "StreamingVWAP", + "inputs": "hlcv", + "stream_total_ms": 2.6068, + "batch_total_ms": 0.0223, + "stream_ns_per_update": 130.34, + "batch_ns_per_bar": 1.11, + "updates_per_second": 7672265.38, + "stream_over_batch_ratio": 116.9385 + } + ] +} \ No newline at end of file