-
Notifications
You must be signed in to change notification settings - Fork 79
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
coin_processor optimization: compile regex once #333
coin_processor optimization: compile regex once #333
Conversation
looks good! can you add how do you test this change? ty |
Currently, there are no unit tests for the indexer. I've conducted tests by running both the old and new versions on the same batch of events and confirmed that the resulting databases are identical. |
Hey thanks for the PR! Could you use once_cell::Lazy instead? I believe it is recommended these days over lazy_static, better API / types rather than macro magic. |
Hi! Made an update, pls take a look! |
rust/Cargo.lock
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Mind removing the Cargo.lock changes from the PR? There aren't any changes to the Cargo.toml so it shouldn't be necessary to include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
003b390
to
5a7d703
Compare
Great! It seems CoinBalance::from_write_resource consumes 5x less CPU with your change. Can you fix the lint and have your PR merged? |
Sure, fixed |
5aac566
to
3ef816b
Compare
Currently, the regular expression is compiled anew with each iteration of the loop. This compilation process is resource-intensive, and there's no built-in caching mechanism. Consider utilizing lazy_static to cache the compiled result for optimization.