Skip to content

Ledger tree: Photon packets hold node to history instead of UID#102

Merged
crisbour merged 4 commits into
mainfrom
ledger-tree
May 16, 2026
Merged

Ledger tree: Photon packets hold node to history instead of UID#102
crisbour merged 4 commits into
mainfrom
ledger-tree

Conversation

@crisbour
Copy link
Copy Markdown
Member

Ledger is now represented in 2 equivalent structures Ledger and LedgerTree, such that during the simulation the LedgerTree is used, described internally by a tree formed of LedgerNode.

Previously the photon packets were holding Uid, however, that required for insertion to perform a lookup in the Ledger every time, even though we already now the element that needs to be accessed from previous allocation.
Furthermore, during simulation the seq_id which need to be allocated uniquely for each new UID value, is not needed for building the chain of events.

Now the photon packets hold an Arc<LedgerNode> that only need to mutate its list of children upon a new allocation. This map is hold under a RwLock internally, hence the API does need to concern itself to how this mechanism works.

Only thing to be aware of now, is that we need to resolve the seq_id values in the tree before we convert LedgerTree to Ledger, such that we can serialize it out.

crisbour added 2 commits May 16, 2026 17:07
Instead of the previous serialisable Ledger and work with UIDs,
now the API is ubiquos to UIDs, but only need to pass the EventId
that the simulation detects and allocate it into a new LedgerNode
(if not already existent).

- This avoids to do a lookup everytime on the `Uid` that the Photon packet
holds, but instead it keeps a reference `Arc<LedgerNode>` to the node
in the `LedgerTree` that represents that `Uid`.
- The caller side doesn't need to concern themself with the locking
  mechanism to access the data concurently, as the RwLock happens
  within the aetherus-events ledger library
- Sequence number are resolved after the events allocation, keeping the
  multi-threaded allocation mechanism very lean, which is most important
  for complex simulations with many photons emitted
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

🐰 Bencher Report

Branch102/merge
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencymicroseconds (µs)
build_objects📈 view plot
🚷 view threshold
16.65 µs
build_tree📈 view plot
🚷 view threshold
11.40 µs
diffusion_sim📈 view plot
🚷 view threshold
1,455,400.00 µs
load_parameters📈 view plot
🚷 view threshold
212.40 µs
🐰 View full continuous benchmarking report in Bencher

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

🐰 Bencher Report

Branch102/merge
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkMean Absolute ErrorBenchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
Root Mean Squared ErrorBenchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
Root Mean Squared Relative ErrorBenchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
Total Variation L1Benchmark Result
Measure (units)
(Result Δ%)
Upper Boundary
Measure (units)
(Limit %)
accuracy_diffusion📈 view plot
🚷 view threshold
0.05 units0.10 units
(50.97%)
📈 view plot
🚷 view threshold
0.07 units0.10 units
(68.85%)
📈 view plot
🚷 view threshold
0.08 units0.10 units
(80.16%)
📈 view plot
🚷 view threshold
7.41 units10.00 units
(74.11%)
🐰 View full continuous benchmarking report in Bencher

@crisbour crisbour merged commit 17fc6de into main May 16, 2026
2 checks passed
@crisbour crisbour deleted the ledger-tree branch May 16, 2026 17:11
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.

1 participant