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

Issue 429: Implement ItemsPerSecond #577

Merged
merged 3 commits into from
Jan 16, 2024

Conversation

alecsmrekar
Copy link
Contributor

@alecsmrekar alecsmrekar commented Dec 22, 2023

Solves this issue: #429

This PR creates a new struct ItemsPerSecond and some accompanying methods that encapsulate the logic of the underlying hash map.

Note:
I had to use #[allow(dead_code)] because for some reason the compiler would complain about dead code, even though the code is being used.

src/graph.rs Outdated

fn initialize_or_increment(&mut self, key: &str, second: usize, value: u32) -> u32 {
if !self.0.contains_key(key) {
self.0.insert(key.to_string(), TimeSeries::new());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe use the insert function here?

src/graph.rs Show resolved Hide resolved
src/graph.rs Outdated
}

fn initialize_or_increment(&mut self, key: &str, second: usize, value: u32) -> u32 {
if !self.0.contains_key(key) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe adding that as a helper function and using here, would make sense, too?

src/graph.rs Show resolved Hide resolved
Copy link
Collaborator

@LionsAd LionsAd left a comment

Choose a reason for hiding this comment

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

Needs some discussion

@alecsmrekar
Copy link
Contributor Author

@LionsAd Thanks for the review, I pushed a new commit with the suggested fixes

src/graph.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@LionsAd LionsAd left a comment

Choose a reason for hiding this comment

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

Looks great, I think we can remove one more line, but then it's RTBC

Copy link
Collaborator

@LionsAd LionsAd left a comment

Choose a reason for hiding this comment

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

RTBM!

@jeremyandrews jeremyandrews merged commit 83442aa into tag1consulting:main Jan 16, 2024
2 checks passed
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.

3 participants