Skip to content

Add a global benchx.conf.json config file for project-wide settings - #65

Merged
MaanasArora merged 8 commits into
benchx-dev:mainfrom
ev-br:global-config
Nov 1, 2026
Merged

MaanasArora merged 8 commits into
benchx-dev:mainfrom
ev-br:global-config

Conversation

@ev-br

@ev-br ev-br commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Currently, various benchmark run parameters are split between the global config (we save something to $HOME/.benchx), two ad hoc .benchx/config.json and .benchx/provider.json, plus a half dozen CLI arguments.

Instead, add a project-wide benchx.conf.json to keep project-wide parameters : name, URI, result/storage paths, adapter-specific parameters. This way, there's a central place for things which are unlikely to change per benchmark, and the CLI gets a bit simpler.

This PR is on top of https://github.com/rok/benchx/pull/64. To make the diff easier to see, here's a PR on my fork, against the gh-64 branch :
ev-br#5
rebased.

@ev-br

ev-br commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

The diff is still ~1KLOC. Not all of it is equally important though. The crux of the PR is

bx compare @plain @hardened --profile environments --label build=plain,hardened \
  --adapter google-benchmark --suite demo-bench --rounds "$ROUNDS" --project archery-local --run-key "$RUN" --out _work/results

to

bx compare @plain @hardened --label build=plain,hardened --rounds "$ROUNDS" --run-key "$RUN" --out _work/results
  • the cmdline CLI switches still work though, and the CLI values take precedence to the config.

Thus, the key questions I'd ask for a review of, are the whole idea of the global config file, and whether the schema makes sense, as added by this PR.

@ev-br ev-br mentioned this pull request Oct 20, 2026
@ev-br

ev-br commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

As discussed in the call, I'd appreciate a review of this PR if somebody has cycles to spare.

@ev-br
ev-br force-pushed the global-config branch 2 times, most recently from 76a8a6f to 96e3499 Compare October 27, 2026 09:51
@ev-br

ev-br commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Could I ask you take a brief look @MaanasArora ? There's quite a bit of implementation details here, which are probably fairly boring plumbing; The main idea is to be able to collect the majority of configuration options into a project-wide config, and add CLI switches on top of it --- I think it improves usability.

There are several examples in the PR itself, e.g. https://github.com/benchx-dev/benchx/pull/65/changes#diff-9dbb3fa728a73cf2d94b3caa9d5a4933213ae649d4987c41d31d92acc8a8c96a, and here's one other example with several bells and whistles at https://github.com/benchx-dev/benchx_examples/blob/main/examples/numpy-spin/benchx.conf.json.

This PR sits in a bottom of a "stack" (the next one in the stack is #71).
Am happy to walk through details in a call if that'd be helpful!

ev-br's Claude Code Agent and others added 8 commits November 1, 2026 11:10
…tree identity

schemas/config/0.1.0 describes benchx.json (the project root's one config
file), with recommended pyperf and Google Benchmark settings as examples
that the tests check against the schema and the adapters' own rules.
snapshot.ignore() leaves the paths benchx writes (the store, the results)
out of git and directory tree identity, so a run's output inside a measured
tree does not mark it dirty.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
benchx.json replaces .benchx/provider.json, the old .benchx/config.json and
the ~/.benchx home. It holds the project, source, provider, and an adapter
block (name, suite, quantities, precision), environment variables, timeouts,
paths and the comparator's policy. The directory holding it is the root; the
store (store.parquet) and the results default to it, and are left out of tree
identity. Every value is the command line's, else the file's, else a default;
a required one (adapter.name, adapter.suite, the target, compare.profile and
rounds) with none is a hard failure naming both. --quantity takes a
comma-separated list, one order collects them all, and --no-project makes a
run ad hoc. bx config init writes a template for either harness and
bx config show says where each value comes from. The old files are not read:
finding one is an error.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The design doc, the scope table and the README describe the project file,
how a value is picked, and the removal of .benchx/provider.json, the old
.benchx/config.json and the ~/.benchx home. archery-local and pyperf-bench
get a benchx.json (the latter now runs `bx bench .`), and the demo gets a
fixed project root, examples/demo, so its store persists across runs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
With one project config, the store is the project root's store.parquet and each
test's root is its own directory.

- test_benchmark_source: read the store as Store(path), not Store().
- test_prototype: the library-level store in the unreadable-files test is its
  own file, so the CLI ingests into the project's store as the test intends
  instead of finding the document there already.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@MaanasArora MaanasArora left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this sat so long, all looks good, just one very nitpicky question inline! I'll just merge as I don't think we need to address it here really. Thanks @ev-br!

CONFIG_FILE = "benchx.conf.json"
# Files of the format this one replaced. They are not read; finding one is an error, so
# no setting silently stops applying.
LEGACY_FILES = (Path(".benchx") / "provider.json", Path(".benchx") / "config.json")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this defense needed? I don't mind it but I'm wondering if anyone is using the old schemas?

@ev-br ev-br Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not---I was keeping this mainly to minimize friction for your and Marco's PRs. Let me send a separate clean-up PR.

EDIT: in fact, let me hold on the clean-up for now: I'll first move/consolidate examples and prototype/examples, make sure they run, and then clean up.
Moving examples needs other PRs though: context-collectors, uc-04 and parametrizations. Sigh.

@MaanasArora
MaanasArora merged commit 878745c into benchx-dev:main Nov 1, 2026
6 checks passed
@ev-br

ev-br commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @MaanasArora !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants