Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network: Like #5906, but for messageFilter, optimize cache mem and speed #5913

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

jannotti
Copy link
Contributor

@jannotti jannotti commented Jan 20, 2024

Don't allocate all the maps ahead of time, when we do allocate them, allocate them fullsize, and use struct{} instead of bool.

I'm a little unsure how well this is exercised in tests, since messageFilter_test.go is just a hash benchmark. But I did intentionally do it wrong at first, saw failures, them did it right.

First noted by @pao-beep

Don't allocate all the maps ahead of time, when we do allocate them,
allocate them fullsize, and use `struct{}` instead of `bool`.
@jannotti jannotti self-assigned this Jan 20, 2024
@jannotti jannotti requested a review from algorandskiy January 20, 2024 22:05
Copy link

codecov bot commented Jan 20, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (877090b) 55.99% compared to head (aae2f88) 55.99%.

Files Patch % Lines
network/messageFilter.go 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5913      +/-   ##
==========================================
- Coverage   55.99%   55.99%   -0.01%     
==========================================
  Files         478      478              
  Lines       67602    67601       -1     
==========================================
- Hits        37855    37854       -1     
+ Misses      27187    27186       -1     
- Partials     2560     2561       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

Looks correct to me.

@jannotti jannotti marked this pull request as ready for review January 22, 2024 17:02
@algorandskiy algorandskiy merged commit 135a1b4 into algorand:master Jan 22, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants