0.17.0: Revision fn and new macro generated accessors.#39
Merged
Conversation
RevisionFn<F> holds the typed symbol pointer plus an Arc on its RevisionEntry (registry entries are now Arc-wrapped), so calls through a handle stay valid regardless of the active revision, future evolutions, or any later pruning API. Handles are Send + Sync + Clone, expose get() for hoisting the bare fn pointer into hot loops, and take_panic() reads the correct per-revision panic buffer (shared with Runtime::take_panic via read_panic_buffer). revision_fn_lookup resolves handles for the macro by decl pointer identity — no strings involved.
For each evolvable fn the macro now also emits an accessor (e.g. decide_fn(revision)) that resolves a RevisionFn typed with the declared signature. The lookup goes through the hidden runtime hook by decl pointer identity, and the only unsafe involved is the same validated-signature cast the dispatch wrapper already relies on. The integration test covers handle independence from the active revision, Send + Clone fan-out concurrent with activate_revision, and per-revision panic routing.
…lease Adds a revision_handle case (fetch once, hoist with get(), call in the loop). Also switches the benched runtime to Profile::Release: with a debug-profile dylib the callee codegen (~5ns) drowned the dispatch difference the bench exists to measure. Measured: direct 0.94ns, evolvable dispatch 1.50ns, revision handle 1.47ns.
Keep the TOP_K best strategies (by training return) during the search instead of only the single best. After the final report, fetch a typed decide_fn handle for each seat — every member dylib is still loaded — and backtest an equal-weight ensemble on the held-out test segment: each candle all members vote and their signed quantities are averaged into one net market order. run_backtest is generalized to run_backtest_with(decide_impl, take_panic, candles) so handles (and combinations of them) backtest exactly like the active revision.
Refresh the dispatch table with numbers measured against a release-compiled dylib and note the per-revision panic buffers.
Typed RevisionFn handles, the <name>_fn macro accessors, and the ensemble showcase are additive API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RevisionFntyped handles that pin retained revisions