Ledger tree: Photon packets hold node to history instead of UID#102
Merged
Conversation
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
|
| Branch | 102/merge |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | microseconds (µ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 |
|
| Branch | 102/merge |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Mean Absolute Error | Benchmark Result Measure (units) (Result Δ%) | Upper Boundary Measure (units) (Limit %) | Root Mean Squared Error | Benchmark Result Measure (units) (Result Δ%) | Upper Boundary Measure (units) (Limit %) | Root Mean Squared Relative Error | Benchmark Result Measure (units) (Result Δ%) | Upper Boundary Measure (units) (Limit %) | Total Variation L1 | Benchmark Result Measure (units) (Result Δ%) | Upper Boundary Measure (units) (Limit %) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| accuracy_diffusion | 📈 view plot 🚷 view threshold | 0.05 units | 0.10 units (50.97%) | 📈 view plot 🚷 view threshold | 0.07 units | 0.10 units (68.85%) | 📈 view plot 🚷 view threshold | 0.08 units | 0.10 units (80.16%) | 📈 view plot 🚷 view threshold | 7.41 units | 10.00 units (74.11%) |
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.
Ledger is now represented in 2 equivalent structures
LedgerandLedgerTree, such that during the simulation the LedgerTree is used, described internally by a tree formed ofLedgerNode.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_idwhich 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 aRwLockinternally, 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_idvalues in the tree before we convertLedgerTreetoLedger, such that we can serialize it out.