Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

structural-computing-bench

Calibrate the cost models used by structural-computing's router by measuring actual wall-clock performance of its leaf evaluators on your machine and fitting a power-law / exponential model to the measurements.

The router decides which evaluator to dispatch to based on a predicted runtime. The shipped predictions are hand-picked defaults; this repo produces machine-specific replacements so the predictions match what your hardware actually does.

Why a separate repo

The benchmark machinery is heavier than the core library — timing primitives, GC handling, curve fitting, problem generators, plus optional plotting / reporting. Keeping it out of the structural-computing PyPI package means:

  • Users installing the framework don't pull in unused benchmarking code.
  • The bench repo can grow heavier deps later (matplotlib, scipy, hypothesis) without bloating the core.
  • Calibration runs can have their own CI and don't interleave with framework PRs.

The output is a small calibration_data.py (or .json) file that the framework's structural_computing.calibration.apply_calibration() loads to update the router's coefficients at runtime.

Quick start

pip install -e .
python scripts/run_calibration.py --out calibration_data/my_machine.py

then in your application:

import importlib.util, importlib
spec = importlib.util.spec_from_file_location(
    "my_calibration", "calibration_data/my_machine.py")
mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod)

from structural_computing.calibration import apply_calibration
apply_calibration(mod.CALIBRATED_COSTS)

# Now the router uses your machine's measured constants.

What gets measured

Leaf evaluator Problem generator Default sizes
_count_solutions_leaf random GF(2) affine n ∈ [4, 8, 12, 16, 20, 24]
_matching_count_leaf (T2) n-cycle (planar) n ∈ [4, 6, 8, 10, 12, 14, 16]
_matching_count_leaf (T4) K_{n,n} bipartite n ∈ [2, 3, 4, 5]
_matchgate_rank_leaf symmetric arity-n sig n ∈ [2, 4, 6, 8, 10, 12]

For each, the harness:

  1. Generates a deterministic problem of size n.
  2. Runs the leaf evaluator repeat=5 times.
  3. Records the median elapsed seconds (median is robust to GC pauses).
  4. Fits both time ≈ a * n^b (power law) and time ≈ a * exp(b * n) (exponential); reports whichever has lower log-residual as the preferred model.

License

MIT-with-attribution to Edward Chalk / sapientronic.ai.

Metadata

Release files for structural-computing-bench 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for structural-computing-bench 0.1.0a1
File Size Uploaded
structural_computing_bench-0.1.0a1.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for structural-computing-bench 0.1.0a1
File Interpreter ABI Platform
structural_computing_bench-0.1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / structural_computing_bench-0.1.0a1.tar.gz

Download URL structural_computing_bench-0.1.0a1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6916595369602a72976d3f724fffcd8f75469418a8535084dac7e81f26a490eb
BLAKE2b-256 checksum
How to use checksums
c01e2dc4d87ecce318025f023eb4bb9b23390537dd88f9ae980eb982346a29fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / structural_computing_bench-0.1.0a1-py3-none-any.whl

Download URL structural_computing_bench-0.1.0a1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fb5de2454bd63dc0209e1cededae06ffc3ac667e46fd2b16ca8ead9bd7322b7
BLAKE2b-256 checksum
How to use checksums
445e82f47bffc477341f3b20bfe1007762f9f8863aae5db08faa8da5df5e8f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page