benchset 0.0.5__tar.gz → 0.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. {benchset-0.0.5 → benchset-0.0.7}/Cargo.lock +1 -1
  2. {benchset-0.0.5 → benchset-0.0.7}/Cargo.toml +2 -1
  3. {benchset-0.0.5 → benchset-0.0.7}/MANIFEST.in +1 -0
  4. {benchset-0.0.5 → benchset-0.0.7}/PKG-INFO +221 -17
  5. {benchset-0.0.5 → benchset-0.0.7}/Package.swift +2 -2
  6. {benchset-0.0.5 → benchset-0.0.7}/README.md +220 -16
  7. {benchset-0.0.5 → benchset-0.0.7}/Sources/Benchset/Benchset.swift +177 -47
  8. {benchset-0.0.5 → benchset-0.0.7}/benchset/__init__.py +2 -0
  9. benchset-0.0.7/benchset/_aggregate.py +81 -0
  10. benchset-0.0.7/benchset/_metadata.json +1 -0
  11. benchset-0.0.7/benchset/_metadata.py +52 -0
  12. benchset-0.0.7/benchset/_native.py +533 -0
  13. benchset-0.0.7/benchset/api.py +247 -0
  14. benchset-0.0.7/benchset/cli.py +417 -0
  15. {benchset-0.0.5 → benchset-0.0.7}/benchset/models.py +26 -4
  16. {benchset-0.0.5 → benchset-0.0.7}/benchset/reference.py +7 -19
  17. {benchset-0.0.5 → benchset-0.0.7}/benchset.egg-info/PKG-INFO +221 -17
  18. benchset-0.0.7/benchset.egg-info/SOURCES.txt +126 -0
  19. benchset-0.0.7/include/benchset.h +207 -0
  20. benchset-0.0.7/native/build.rs +69 -0
  21. benchset-0.0.7/native/src/aggregate_protocol_tests.rs +545 -0
  22. benchset-0.0.7/native/src/aggregation_ffi.rs +173 -0
  23. benchset-0.0.7/native/src/aggregation_ffi_tests.rs +279 -0
  24. benchset-0.0.7/native/src/catalog.rs +33 -0
  25. benchset-0.0.7/native/src/config_ffi.rs +79 -0
  26. benchset-0.0.7/native/src/config_ffi_tests.rs +296 -0
  27. benchset-0.0.7/native/src/configured_suite_tests.rs +350 -0
  28. {benchset-0.0.5 → benchset-0.0.7}/native/src/ffi.rs +44 -10
  29. {benchset-0.0.5 → benchset-0.0.7}/native/src/ffi_reference_tests.rs +29 -3
  30. {benchset-0.0.5 → benchset-0.0.7}/native/src/ffi_tests.rs +115 -0
  31. {benchset-0.0.5 → benchset-0.0.7}/native/src/lib.rs +166 -22
  32. benchset-0.0.7/native/src/observed_suite_tests.rs +179 -0
  33. {benchset-0.0.5 → benchset-0.0.7}/native/src/runtime_tests.rs +132 -45
  34. benchset-0.0.7/native/src/suite_ffi.rs +314 -0
  35. benchset-0.0.7/native/src/suite_ffi_tests.rs +477 -0
  36. benchset-0.0.7/native/src/suite_tests.rs +283 -0
  37. {benchset-0.0.5 → benchset-0.0.7}/pyproject.toml +3 -3
  38. {benchset-0.0.5 → benchset-0.0.7}/scripts/build_native.py +3 -7
  39. benchset-0.0.7/scripts/cargo.py +111 -0
  40. {benchset-0.0.5 → benchset-0.0.7}/scripts/check_source_install.py +21 -1
  41. {benchset-0.0.5 → benchset-0.0.7}/scripts/package_native.py +15 -5
  42. {benchset-0.0.5 → benchset-0.0.7}/scripts/release.py +5 -2
  43. {benchset-0.0.5 → benchset-0.0.7}/setup.py +45 -10
  44. benchset-0.0.7/tests/helpers.py +68 -0
  45. benchset-0.0.7/tests/swift/AggregationTests.swift +25 -0
  46. {benchset-0.0.5 → benchset-0.0.7}/tests/swift/BenchsetTests.swift +577 -39
  47. benchset-0.0.7/tests/test_aggregate_exponential.py +278 -0
  48. benchset-0.0.7/tests/test_aggregate_getters.py +151 -0
  49. benchset-0.0.7/tests/test_aggregate_memory.py +51 -0
  50. benchset-0.0.7/tests/test_aggregate_protocols.py +321 -0
  51. benchset-0.0.7/tests/test_aggregate_tuple_inputs.py +116 -0
  52. benchset-0.0.7/tests/test_aggregation_boundary.py +161 -0
  53. benchset-0.0.7/tests/test_approved_python_contracts.py +311 -0
  54. {benchset-0.0.5 → benchset-0.0.7}/tests/test_benchset.py +9 -1
  55. {benchset-0.0.5 → benchset-0.0.7}/tests/test_build.py +31 -3
  56. benchset-0.0.7/tests/test_build_native.py +88 -0
  57. {benchset-0.0.5 → benchset-0.0.7}/tests/test_cli.py +421 -39
  58. benchset-0.0.7/tests/test_cli_active_signal_policy.py +140 -0
  59. benchset-0.0.7/tests/test_cli_cleanup_signals.py +328 -0
  60. benchset-0.0.7/tests/test_cli_embedded_signals.py +269 -0
  61. benchset-0.0.7/tests/test_cli_final_signal_restore.py +191 -0
  62. benchset-0.0.7/tests/test_cli_loader_validation.py +88 -0
  63. benchset-0.0.7/tests/test_cli_loading_signals.py +343 -0
  64. benchset-0.0.7/tests/test_cli_observer_signals.py +111 -0
  65. benchset-0.0.7/tests/test_cli_progress_streams.py +217 -0
  66. benchset-0.0.7/tests/test_cli_signal_policy.py +144 -0
  67. benchset-0.0.7/tests/test_cli_terminal_errors.py +134 -0
  68. benchset-0.0.7/tests/test_core_contract.py +45 -0
  69. {benchset-0.0.5 → benchset-0.0.7}/tests/test_errors.py +51 -13
  70. benchset-0.0.7/tests/test_exception_contexts.py +180 -0
  71. benchset-0.0.7/tests/test_float_transport.py +141 -0
  72. benchset-0.0.7/tests/test_installer_copy.py +379 -0
  73. benchset-0.0.7/tests/test_interpreter_boundary.py +241 -0
  74. benchset-0.0.7/tests/test_loader_failures.py +391 -0
  75. benchset-0.0.7/tests/test_loader_imports.py +123 -0
  76. benchset-0.0.7/tests/test_metadata.py +537 -0
  77. benchset-0.0.7/tests/test_name_diagnostics.py +106 -0
  78. benchset-0.0.7/tests/test_name_operands.py +181 -0
  79. benchset-0.0.7/tests/test_native_coverage.py +280 -0
  80. benchset-0.0.7/tests/test_native_lifetimes.py +286 -0
  81. benchset-0.0.7/tests/test_packaging.py +188 -0
  82. benchset-0.0.7/tests/test_publication.py +283 -0
  83. benchset-0.0.7/tests/test_publication_signals.py +576 -0
  84. benchset-0.0.7/tests/test_python_core.py +653 -0
  85. benchset-0.0.7/tests/test_quiet_validation.py +457 -0
  86. {benchset-0.0.5 → benchset-0.0.7}/tests/test_reference.py +28 -8
  87. {benchset-0.0.5 → benchset-0.0.7}/tests/test_reference_artifacts.py +370 -35
  88. {benchset-0.0.5 → benchset-0.0.7}/tests/test_reference_native.py +2 -0
  89. benchset-0.0.7/tests/test_release.py +688 -0
  90. benchset-0.0.7/tests/test_resources.py +329 -0
  91. benchset-0.0.7/tests/test_runner_thread_safety.py +201 -0
  92. benchset-0.0.7/tests/test_rust_api.py +102 -0
  93. {benchset-0.0.5 → benchset-0.0.7}/tests/test_semantics.py +141 -26
  94. benchset-0.0.7/tests/test_setup.py +260 -0
  95. {benchset-0.0.5 → benchset-0.0.7}/tests/test_signals.py +79 -12
  96. benchset-0.0.7/tests/test_suite.py +375 -0
  97. benchset-0.0.7/tests/test_suite_options.py +442 -0
  98. benchset-0.0.7/tests/test_suite_signal_policy.py +297 -0
  99. benchset-0.0.7/tests/test_validation_lifetime.py +307 -0
  100. {benchset-0.0.5 → benchset-0.0.7}/tests/test_version.py +28 -4
  101. {benchset-0.0.5 → benchset-0.0.7}/tests/typing/reference_positive.py +16 -2
  102. {benchset-0.0.5 → benchset-0.0.7}/tests/typing/test_reference_types.py +9 -3
  103. benchset-0.0.5/benchset/_native.py +0 -263
  104. benchset-0.0.5/benchset/api.py +0 -164
  105. benchset-0.0.5/benchset/cli.py +0 -270
  106. benchset-0.0.5/benchset.egg-info/SOURCES.txt +0 -67
  107. benchset-0.0.5/include/benchset.h +0 -109
  108. benchset-0.0.5/tests/helpers.py +0 -35
  109. benchset-0.0.5/tests/test_release.py +0 -358
  110. benchset-0.0.5/tests/test_resources.py +0 -118
  111. {benchset-0.0.5 → benchset-0.0.7}/LICENSE +0 -0
  112. {benchset-0.0.5 → benchset-0.0.7}/benchset/__main__.py +0 -0
  113. {benchset-0.0.5 → benchset-0.0.7}/benchset/py.typed +0 -0
  114. {benchset-0.0.5 → benchset-0.0.7}/benchset.egg-info/dependency_links.txt +0 -0
  115. {benchset-0.0.5 → benchset-0.0.7}/benchset.egg-info/entry_points.txt +0 -0
  116. {benchset-0.0.5 → benchset-0.0.7}/benchset.egg-info/requires.txt +0 -0
  117. {benchset-0.0.5 → benchset-0.0.7}/benchset.egg-info/top_level.txt +0 -0
  118. {benchset-0.0.5 → benchset-0.0.7}/examples/native/c.c +0 -0
  119. {benchset-0.0.5 → benchset-0.0.7}/examples/native/rust.rs +0 -0
  120. {benchset-0.0.5 → benchset-0.0.7}/examples/native/swift.swift +0 -0
  121. {benchset-0.0.5 → benchset-0.0.7}/include/module.modulemap +0 -0
  122. {benchset-0.0.5 → benchset-0.0.7}/native/reference-calibration.json +0 -0
  123. {benchset-0.0.5 → benchset-0.0.7}/native/src/kernel.rs +0 -0
  124. {benchset-0.0.5 → benchset-0.0.7}/native/src/kernel_tests.rs +0 -0
  125. {benchset-0.0.5 → benchset-0.0.7}/native/src/reference.rs +0 -0
  126. {benchset-0.0.5 → benchset-0.0.7}/native/src/reference_tests.rs +0 -0
  127. {benchset-0.0.5 → benchset-0.0.7}/rust-toolchain.toml +0 -0
  128. {benchset-0.0.5 → benchset-0.0.7}/scripts/__init__.py +0 -0
  129. {benchset-0.0.5 → benchset-0.0.7}/scripts/build_backend.py +0 -0
  130. {benchset-0.0.5 → benchset-0.0.7}/scripts/check_native_coverage.py +0 -0
  131. {benchset-0.0.5 → benchset-0.0.7}/scripts/version.py +0 -0
  132. {benchset-0.0.5 → benchset-0.0.7}/setup.cfg +0 -0
  133. {benchset-0.0.5 → benchset-0.0.7}/tests/__init__.py +0 -0
  134. {benchset-0.0.5 → benchset-0.0.7}/tests/swift/ReferenceTests.swift +0 -0
  135. {benchset-0.0.5 → benchset-0.0.7}/tests/typing/__init__.py +0 -0
  136. {benchset-0.0.5 → benchset-0.0.7}/tests/typing/reference_negative.py +0 -0
@@ -4,4 +4,4 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "benchset"
7
- version = "0.0.5"
7
+ version = "0.0.7"
@@ -1,9 +1,10 @@
1
1
  [package]
2
2
  name = "benchset"
3
3
  # Generated from [project].version in pyproject.toml by scripts/version.py.
4
- version = "0.0.5"
4
+ version = "0.0.7"
5
5
  edition = "2021"
6
6
  rust-version = "1.74"
7
+ build = "native/build.rs"
7
8
  description = "Embeddable sustained scalar CPU benchmarks with a C ABI"
8
9
  license = "MIT"
9
10
  repository = "https://github.com/mutating/benchset"
@@ -2,6 +2,7 @@ include setup.py
2
2
  include Cargo.toml Cargo.lock rust-toolchain.toml LICENSE README.md
3
3
  recursive-include native *.rs
4
4
  include native/reference-calibration.json
5
+ include benchset/_metadata.json
5
6
  recursive-include include *.h *.modulemap
6
7
  recursive-include scripts *.py
7
8
  recursive-include examples *.c *.rs *.swift
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchset
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Sustained scalar CPU benchmarks with an embeddable Rust core
5
5
  Author-email: Evgeniy Blinov <zheni-b@yandex.ru>
6
6
  Project-URL: Source, https://github.com/mutating/benchset
@@ -38,6 +38,18 @@ Sustained scalar CPU throughput, with an embeddable Rust core, a public C ABI,
38
38
  a Python library, a CLI, and a macOS Swift package. No Python interpreter is
39
39
  needed by applications embedding the native library.
40
40
 
41
+ Rust is the single source of benchmark behavior: workloads, timing, validation,
42
+ suite order and early stopping, scores and aggregation all live in the native
43
+ core. Python and Swift are thin bindings to its C ABI. They handle language
44
+ types, callbacks, signals and native-handle lifetimes without reimplementing
45
+ benchmark rules. The C ABI supports both static and dynamic linking.
46
+
47
+ Benchmark identities, default durations and calibration are also defined in
48
+ Rust. Native builds generate the Python package's `_metadata.json` from those
49
+ definitions; it is a generated data snapshot, not a second implementation.
50
+ This keeps imports, metadata inspection and CLI help available without loading
51
+ the native library. Update Rust sources rather than editing that snapshot.
52
+
41
53
  The initial suite contains **`single_core`** (one computational worker) and
42
54
  **`multi_core`** (all available computational workers). Both execute the same
43
55
  fixed mixed workload and return a score in **completed iterations per second**.
@@ -45,6 +57,10 @@ Higher is faster. Each completed result also includes a **Pi equivalent**:
45
57
  its throughput divided by the same benchmark's sustained Raspberry Pi 5 score.
46
58
  `0.5` means half the Pi's throughput, `1.0` equal throughput, and `2.0` twice
47
59
  the Pi's throughput. The CLI prints both iterations/s and `Pi equivalent`.
60
+ The full suite also returns **aggregated scores**. Its **Full Pi equivalent** is
61
+ the geometric mean of the individual Pi equivalents, with equal weights.
62
+ See [Full-suite score](#full-suite-score) for the formula, availability rules
63
+ and the field to read in each interface.
48
64
 
49
65
  This README describes the current source tree. For changes not yet published,
50
66
  use `pip install .` or the local Rust/Swift dependencies described below.
@@ -92,11 +108,15 @@ Completed result fields, including all measurement samples, are printed to
92
108
  stdout. Failed/cancelled results go to stderr. Exit codes: 0 completed, 1
93
109
  execution failure, 2 invalid CLI arguments, 130 interrupted/cancelled. The
94
110
  suite stops after a failed or cancelled benchmark.
111
+ Duration validation loads the Rust library. If loading fails, that error takes
112
+ precedence over invalid duration values and the CLI exits with code 1.
113
+ Argument syntax, `--help` and `--version` do not require loading the library.
95
114
  Each result is flushed immediately, including when stdout is redirected.
96
115
  Progress fits the terminal width and is cleared before the result. Output
97
116
  uses `× pi` and `—` when the stream supports them, with `x pi` and `-` as
98
- fallbacks for restrictive encodings. A closed stdout pipe exits with code 1
99
- without a traceback.
117
+ fallbacks for restrictive encodings. Streams configured with `backslashreplace`
118
+ may emit Unicode escape sequences instead. A closed stdout pipe exits with
119
+ code 1 without a traceback.
100
120
 
101
121
  For example, a completed result at half the reference throughput includes
102
122
  these lines (illustrative values; other fields and samples are omitted):
@@ -112,10 +132,87 @@ Pi equivalent : 0.5 × pi
112
132
  The multiplier uses the full-precision native score, before display rounding.
113
133
  An unavailable multiplier is displayed as `—` (`-` in the fallback format).
114
134
 
135
+ ## Full-suite score
136
+
137
+ Run the complete suite to obtain its overall score:
138
+
139
+ | Interface | Run the suite | Read the Full Pi equivalent |
140
+ |---|---|---|
141
+ | CLI | `benchset` or `benchset --bench all` | Final `Full Pi equivalent` line |
142
+ | Python | `suite = run_all(...)` (module-level function) | `suite.aggregated_scores.pi_equivalent` |
143
+ | Rust | `let suite = benchset::run_all(options, &cancellation, callback);` | `suite.aggregated_scores.pi_equivalent` |
144
+ | Swift | `let suite = try runner.runAll(...)` | `suite.aggregatedScores.piEquivalent` |
145
+ | C / C++ | `benchset_run_all(...)`, then `benchset_suite_result(...)` | `suite.aggregated_scores.pi_equivalent` when `has_pi_equivalent != 0` |
146
+
147
+ For each benchmark, let `r = score / that_benchmark_reference_score`.
148
+ For positive ratios, the full score is `exp(sum(ln(r)) / benchmark_count)`.
149
+ With the current two benchmarks this is mathematically
150
+ `sqrt(r_single_core * r_multi_core)`. Each benchmark has equal weight,
151
+ independently of its worker count or measurement duration. The resulting
152
+ multiplier is dimensionless; individual `score` fields remain iterations/s.
153
+
154
+ The Rust core uses natural logarithms and `exp` on the original,
155
+ unrounded double-precision ratios. Log space avoids intermediate overflow or
156
+ underflow from multiplying ratios. Any consistent logarithm base and its
157
+ inverse give the same mathematical result; ordinary floating-point rounding
158
+ still applies. For example, `0.5` and `2.0` produce exactly `1.0`, and `1.0`
159
+ and `4.0` produce `2.0`. The first example's CLI summary is:
160
+
161
+ ```text
162
+ Full Pi equivalent : 1 × pi
163
+ ```
164
+
165
+ A full score requires exactly `single_core` then `multi_core`, both with
166
+ `completed` status and a present, finite, nonnegative Pi equivalent. Completed
167
+ unstable results participate. After validating the complete set, any zero ratio
168
+ makes the full score `0.0`. Zero is a valid score: check `is not None` in Python,
169
+ `Some` in Rust, `if let` in Swift, or the presence flag in C.
170
+ Native numeric validation rejects NaN and infinities without adding floating-point
171
+ exception flags; flags already set by the caller are preserved. Native validation
172
+ classifies the stored numeric value even when the FPU flushes subnormal numbers
173
+ to zero; this also applies to duration validation in every language.
174
+
175
+ An incomplete, failed or cancelled suite has no aggregate: `None` in
176
+ Python/Rust, `nil` in Swift, or a zero presence flag in C. When a benchmark
177
+ fails or is cancelled, a returned suite retains the completed prefix and the
178
+ first unsuccessful result. Results assembled by callers must also have the
179
+ complete order, without duplicates or
180
+ extra entries. Use `SuiteResult.from_results(tuple_of_results)` in Python,
181
+ `SuiteResult::new(results)` in Rust, or `SuiteResult(results: results)` in Swift
182
+ to calculate the aggregate from their stored individual Pi equivalents.
183
+ The Python and Swift factories call the same Rust calculator through the C ABI.
184
+ Python's direct `SuiteResult(results, aggregated_scores)` constructor stores
185
+ the supplied fields; it does not calculate an aggregate.
186
+
187
+ The CLI prints the summary on stdout after success or stderr after
188
+ failure/cancellation, using `—` (`-` in the fallback format) when unavailable.
189
+ An interrupted CLI call suppresses the aggregate even if its final native
190
+ result had already completed. Selecting only one benchmark prints no suite
191
+ summary. Progress fractions belong to the benchmark currently running and
192
+ restart for the next benchmark.
193
+
115
194
  ## Python API
116
195
 
117
196
  Python 3.8–3.15, including free-threaded CPython, is supported. The wrapper uses
118
197
  standard-library `ctypes` and loads the version-matched bundled native library.
198
+ `run`, `run_all` and `SuiteResult.from_results` require that native library,
199
+ including when inputs are invalid or an aggregate is unavailable. A library
200
+ loading or compatibility error takes precedence over benchmark argument
201
+ validation. Argument checks and their diagnostics are supplied by Rust;
202
+ Python still performs its ordinary numeric type conversions at the boundary.
203
+ Integer subclass ratios are calculated from their `float(...)` conversions;
204
+ Python aggregation retains Python comparisons, including their behavior under
205
+ the caller's FPU mode and subclass overrides. Each requested `result.success`
206
+ value is converted to `bool` once. When aggregating a tuple subclass,
207
+ the factory uses its actual stored elements and length, retaining the original
208
+ tuple in `suite.results`.
209
+
210
+ Benchmark names must be strings. A name subclass may customize an unknown-name
211
+ diagnostic through Python's string operators; its result must also be a string,
212
+ otherwise `TypeError` is raised before any benchmark starts. Compatibility
213
+ covers the documented public API, not incidental dependency names imported by
214
+ internal modules or the exact time temporary Python objects are finalized.
215
+ The CLI does not guarantee context-variable inheritance by its internal threads.
119
216
 
120
217
  ```python
121
218
  from benchset import run, run_all
@@ -126,7 +223,15 @@ if result.success:
126
223
  else:
127
224
  print(result.status, result.reason)
128
225
 
129
- results = run_all(warmup_seconds=120, measurement_seconds=60)
226
+ suite = run_all(warmup_seconds=120, measurement_seconds=60)
227
+ results = suite.results # Tuple[BenchmarkResult, ...]
228
+ full_pi = suite.aggregated_scores.pi_equivalent
229
+ if full_pi is not None:
230
+ print(f'Full Pi equivalent: {full_pi} x pi')
231
+ else:
232
+ for item in results:
233
+ if not item.success:
234
+ print(item.benchmark, item.status, item.reason)
130
235
  print(result.reference_run.started_at, result.reference_run.results)
131
236
  ```
132
237
 
@@ -149,12 +254,22 @@ with ThreadPoolExecutor(max_workers=1) as pool:
149
254
  Callbacks execute on the thread calling `run`, approximately ten times per
150
255
  second and on observed phase transitions. A very short phase can finish before
151
256
  the coordinator reports it, so callback sequences may omit that phase.
152
- Callbacks receive the benchmark name, phase,
257
+ Callbacks receive one `Progress` object containing the benchmark name, phase,
153
258
  worker count, overall fraction, phase elapsed/target time and completed
154
259
  iterations in that phase. Dispatch UI updates to the UI thread yourself and
155
260
  return promptly. A Python callback exception cancels the workload and produces
156
261
  a failed result; it does not propagate through C.
157
262
 
263
+ `run_all()` returns an immutable `SuiteResult`, with `results` (a tuple of
264
+ individual results in execution order) and `aggregated_scores: AggregatedScores`.
265
+ The current aggregate is `pi_equivalent: Optional[float]`; see
266
+ [Full-suite score](#full-suite-score) for its calculation and availability.
267
+ `dataclasses.asdict(suite)` produces `{"results": ..., "aggregated_scores":
268
+ {"pi_equivalent": ...}}`, including the individual results' nested calibration
269
+ records. `dataclasses.asdict(result)` also works for a single benchmark.
270
+ Consumers that previously iterated over `run_all()` directly should now iterate
271
+ over `run_all().results`.
272
+
158
273
  `BenchmarkRunner.cancel()` is thread-safe and requests cancellation without
159
274
  waiting for the active call to finish. After `run()` returns, all native workers
160
275
  are joined and the runner can be reused. Concurrent
@@ -330,6 +445,8 @@ Swift uses camelCase fields, such as `shortName`, `startedAtUnixSeconds` and
330
445
  `started_at` datetime; Swift offers `startedAt: Date` for the same instant.
331
446
  The frozen Python records use a tuple for results; Swift returns immutable
332
447
  value snapshots. Reading the Python globals does not load the native library.
448
+ Their values come from the Rust-generated snapshot bundled with the package;
449
+ builds refresh it from the same sources used to compile the native library.
333
450
 
334
451
  [Calibration values and provenance](native/reference-calibration.json) include
335
452
  the original kernel commit, binary SHA-256, raw pooled totals and series
@@ -354,9 +471,12 @@ settings are comparable.
354
471
 
355
472
  ## Embed in Rust
356
473
 
474
+ Source consumers need Rust 1.74 or newer. Published native binaries use the
475
+ pinned release toolchain described under [Publishing](#publishing).
476
+
357
477
  ```toml
358
478
  [dependencies]
359
- benchset = "0.0.5"
479
+ benchset = "0.0.7"
360
480
  # For changes from a local source checkout, use:
361
481
  # benchset = { path = "../benchset" }
362
482
  ```
@@ -372,11 +492,23 @@ if let (Some(score), Some(equivalent)) = (result.score, result.pi_equivalent) {
372
492
  println!("{:?}: {}", result.status, result.reason);
373
493
  }
374
494
  println!("Reference warmup: {} s", result.reference_run.warmup_seconds);
495
+
496
+ let suite_cancellation = Cancellation::default();
497
+ let suite = benchset::run_all(Options::default(), &suite_cancellation, |benchmark, progress| {
498
+ println!("{}: {}", benchmark.name(), progress.fraction);
499
+ });
500
+ if let Some(full_pi) = suite.aggregated_scores.pi_equivalent {
501
+ println!("Full Pi equivalent: {full_pi} x pi");
502
+ } else {
503
+ println!("Full Pi equivalent unavailable");
504
+ }
505
+ // suite.results contains the individual BenchmarkResult values in order.
375
506
  ```
376
507
 
377
- The cancellation token can be cloned and cancelled from another thread. It is
378
- sticky: create a new token for a new call. A short runnable example is in
379
- `examples/native/rust.rs`.
508
+ The cancellation token can be cloned and cancelled from another thread. Once
509
+ cancelled, it stays cancelled; create a fresh token for a subsequent uncancelled
510
+ call. The suite uses the same token across both benchmarks. A short runnable
511
+ example is in `examples/native/rust.rs`.
380
512
 
381
513
  ## Embed through C ABI
382
514
 
@@ -422,6 +554,43 @@ string is valid for the loaded library's lifetime. Progress pointers are
422
554
  borrowed only during the callback. Do not free a handle while it is in use or
423
555
  throw/unwind through a C callback. Invalid configuration produces a failed result.
424
556
 
557
+ For a full suite, create a `BenchsetSuiteHandle` with `benchset_suite_create()`
558
+ and call `benchset_run_all(handle, &config, callback, context)`. The benchmark
559
+ selector is ignored; warmup and measurement settings apply to each benchmark.
560
+ The callback receives `BenchsetSuiteProgress`, containing the benchmark ID and
561
+ its progress. `benchset_run_all` returns the final individual result's status.
562
+ After the call, `benchset_suite_result(handle, &suite, sizeof(suite))`
563
+ fills a `BenchsetSuiteResult` with `results`, `result_count` and
564
+ `aggregated_scores`, returning 1 on success or 0 if the getter fails.
565
+ The immutable result array is borrowed until the handle is freed.
566
+ Check `suite.aggregated_scores.has_pi_equivalent` before reading its
567
+ `pi_equivalent` value. Read individual results with `benchset_suite_result_at`
568
+ (V3 format), and diagnostics with `benchset_suite_sample` and
569
+ `benchset_suite_reason`. Use `benchset_suite_cancel` and `benchset_suite_free`
570
+ for cancellation and cleanup. The same single-use and lifetime rules apply.
571
+
572
+ `benchset_run_all_observed` additionally accepts a result callback for streaming
573
+ each result before the next benchmark starts. Its child handle is borrowed only
574
+ during that callback; copy diagnostics through the single-benchmark getters.
575
+ Returning any nonzero value stops further benchmarks. Python and Swift bindings
576
+ use this entry point; suite ordering and stopping remain in Rust.
577
+
578
+ For example, using the initialized `config` above and no progress callback:
579
+
580
+ ```c
581
+ BenchsetSuiteHandle *suite_handle = benchset_suite_create();
582
+ if (!suite_handle) return 1;
583
+ benchset_run_all(suite_handle, &config, NULL, NULL);
584
+ BenchsetSuiteResult suite;
585
+ if (benchset_suite_result(suite_handle, &suite, sizeof(suite)) &&
586
+ suite.aggregated_scores.has_pi_equivalent != 0) {
587
+ printf("Full Pi equivalent: %.12g x pi\n", suite.aggregated_scores.pi_equivalent);
588
+ } else {
589
+ printf("Full Pi equivalent unavailable\n");
590
+ }
591
+ benchset_suite_free(suite_handle);
592
+ ```
593
+
425
594
  The C ABI version remains 1. The additive, size-checked
426
595
  `benchset_reference_machine`, `benchset_reference_run` and indexed
427
596
  `benchset_reference_result` getters need no handle. Their
@@ -473,7 +642,7 @@ the same repository. Rust is not required by the consumer.
473
642
  For a Swift manifest, add:
474
643
 
475
644
  ```swift
476
- .package(url: "https://github.com/mutating/benchset.git", .exact("0.0.5"))
645
+ .package(url: "https://github.com/mutating/benchset.git", .exact("0.0.7"))
477
646
  ```
478
647
 
479
648
  Add `.product(name: "Benchset", package: "benchset")` to your target's
@@ -499,9 +668,26 @@ if let score = result.score, let equivalent = result.piEquivalent {
499
668
  print(result.status, result.reason as Any)
500
669
  }
501
670
  print(result.referenceRun.startedAt, result.referenceRun.warmupSeconds)
502
- // Another thread may call runner.cancel() while run is active.
671
+ let suite = try runner.runAll(warmupSeconds: 120, measurementSeconds: 60) { benchmark, progress in
672
+ print(benchmark, progress.fraction)
673
+ }
674
+ if let fullPi = suite.aggregatedScores.piEquivalent {
675
+ print("Full Pi equivalent: \(fullPi) x pi")
676
+ } else {
677
+ print("Full Pi equivalent unavailable")
678
+ }
679
+ // suite.results contains the individual BenchmarkResult values in order.
680
+ // Another thread may call runner.cancel() while run or runAll is active.
503
681
  ```
504
682
 
683
+ `runAll` keeps the runner reserved across both benchmarks; cancellation also
684
+ applies between benchmarks through the native suite's cancellation token.
685
+ Both Swift `runAll` and Python `run_all` call the Rust suite runner through C.
686
+ Native failure/cancellation returns the
687
+ results obtained so far with a `nil` aggregate. Wrapper errors such as allocation
688
+ failure or an unavailable native result throw `BenchsetError`; that call returns
689
+ no `SuiteResult`.
690
+
505
691
  To build the Apple package from source:
506
692
 
507
693
  ```sh
@@ -530,15 +716,28 @@ are not part of the initial prebuilt matrix.
530
716
  python -m venv .venv
531
717
  # Activate the virtual environment using your shell's normal command.
532
718
  pip install -r requirements_dev.txt 'skelet>=0.0.21' wheel setuptools
533
- pip install .
534
- python scripts/build_native.py
535
- python -m pytest
536
- cargo test -- --test-threads=1
719
+ pip install -e .
720
+ python -m pytest tests
537
721
  python -m build
722
+ # Native development commands additionally require Cargo on PATH:
723
+ python scripts/build_native.py
724
+ cargo test --locked -- --test-threads=1
538
725
  ```
539
726
 
540
- `scripts/build_native.py` makes the source Python package usable without an
541
- installation. Release wheels are platform-specific but interpreter-independent
727
+ The editable install builds the native library and installs Python dependencies
728
+ and package metadata. `scripts/build_native.py` rebuilds the library beside the
729
+ Python source; it requires Cargo on PATH and does not install Python package
730
+ metadata. Imports still need that metadata because the version is read through
731
+ `importlib.metadata`. After changing the package version, reinstall the Python
732
+ package so its metadata and native library agree. Python-only development can
733
+ use `pip install -e .` to build with the private Rust bootstrap; it does not put
734
+ Cargo on the shell's PATH for standalone native commands.
735
+
736
+ Build and native packaging commands honor `CARGO_TARGET_DIR`; relative paths
737
+ are resolved against the project directory. The frozen-crate verification uses
738
+ the same Cargo output directory.
739
+
740
+ Release wheels are platform-specific but interpreter-independent
542
741
  (`py3-none-<platform>`). The sdist includes the native source. Tests validate
543
742
  correctness, result accounting, progress, cancellation and API/CLI behavior;
544
743
  they do not enforce speed thresholds in CI.
@@ -557,6 +756,11 @@ The [test matrix](tests/coverage-plan.md) combines five independent reviews and
557
756
  covers measurement accounting, statistical boundaries, cancellation, reentry,
558
757
  callback failures, C ABI validation, ownership and CLI behavior. Tests use
559
758
  controlled initialization failures instead of exhausting machine resources.
759
+ Full-suite tests also cover complete ordering, geometric means of unrounded
760
+ ratios, zero/invalid/extreme values, early stopping, serialization and the
761
+ aggregate's presence in each public interface.
762
+ The [core centralization regression matrix](tests/core-centralization-plan.md)
763
+ maps the shared-core contracts to characterization tests and directed mutations.
560
764
 
561
765
  Python coverage includes statements and branches, including CLI subprocesses;
562
766
  CI installs a coverage startup hook for those subprocesses. Rust and Swift each
@@ -9,8 +9,8 @@ let package = Package(
9
9
  products: [.library(name: "Benchset", targets: ["Benchset"])],
10
10
  targets: [
11
11
  .binaryTarget(name: "CBenchset",
12
- url: "https://github.com/mutating/benchset/releases/download/v0.0.5/Benchset.xcframework.zip",
13
- checksum: "6e52d62ca06524cf34f7bef608662c4f9dad924a8912962fe97a1ac66004d33a"),
12
+ url: "https://github.com/mutating/benchset/releases/download/v0.0.7/Benchset.xcframework.zip",
13
+ checksum: "85dd0a47b292aa8411713c8e19445ab3980de7fafb94b9781ec8e452dee77246"),
14
14
  .target(name: "Benchset", dependencies: ["CBenchset"]),
15
15
  .testTarget(name: "BenchsetTests", dependencies: ["Benchset"], path: "tests/swift")
16
16
  ]