Skip to content

Conversation

AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented Apr 28, 2025

Leveraging the fact the Version::INVALID is 0 to pack the metadata versions better in memory. Version needs 4 bytes (u32) while Option needs 8. PeerMetadataVersion now needs 16 bytes instead of 32, same for Header.

The other change is to let MetadataVersions keep track of the actual observed version of the peer as this might come handy for introspection later. This doesn't impact performance as we still only notify if the version is higher than our latest local view.

// intentionally empty

Stack created with Sapling. Best reviewed with ReviewStack.

Copy link

github-actions bot commented Apr 28, 2025

Test Results

  7 files  ±0    7 suites  ±0   4m 46s ⏱️ -6s
 54 tests ±0   53 ✅ ±0  1 💤 ±0  0 ❌ ±0 
223 runs  ±0  220 ✅ ±0  3 💤 ±0  0 ❌ ±0 

Results for commit 03eae28. ± Comparison against base commit f6cbbb2.

♻️ This comment has been updated with latest results.

in_response_to,
span_context: None,
/// Returns the version of the metadata for the given kind.
#[must_use]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this a must_use ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a good habit for functions that have no side effects. If the only value of calling a function is its return value, then you'd want the linter to notify them if they aren't using the return value.

Copy link
Contributor

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Nice changes :-) LGTM. +1 for merging.

Leveraging the fact the Version::INVALID is 0 to pack the metadata versions better in memory. Version needs 4 bytes (u32) while Option<Version> needs 8. `PeerMetadataVersion` now needs 16 bytes instead of 32, same for `Header`.

The other change is to let `MetadataVersions` keep track of the actual observed version of the peer as this might come handy for introspection later. This doesn't impact performance as we still only notify if the version is higher than our latest local view.

```
// intentionally empty
```
@AhmedSoliman AhmedSoliman merged commit 03eae28 into main Apr 30, 2025
51 checks passed
@AhmedSoliman AhmedSoliman deleted the pr3196 branch April 30, 2025 09:35
@github-actions github-actions bot locked and limited conversation to collaborators Apr 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants