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

refactor: compile all regexes at init #1592

Merged
merged 3 commits into from
Jan 31, 2024
Merged

Conversation

thehowl
Copy link
Member

@thehowl thehowl commented Jan 26, 2024

This PR changes all regexes (except for some in test files) in the code to make them compile at init.

This, aside from giving a slight performance optimisation by skipping the compile stage on execution, allows also to ensure that the regexes themselves are correct by panicking at program start-up if they are not. (before this PR, in almost every instance where we used regexp.MatchString or similar, we did not check the error).

@thehowl thehowl self-assigned this Jan 26, 2024
@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Jan 26, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

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

Comparison is base (b619351) 55.80% compared to head (59def79) 55.79%.
Report is 1 commits behind head on master.

Files Patch % Lines
tm2/pkg/amino/pkg/pkg.go 0.00% 0 Missing and 2 partials ⚠️
tm2/pkg/std/memfile.go 33.33% 0 Missing and 2 partials ⚠️
gno.land/pkg/sdk/vm/keeper.go 0.00% 0 Missing and 1 partial ⚠️
gnovm/pkg/gnolang/nodes.go 0.00% 0 Missing and 1 partial ⚠️
gnovm/pkg/gnolang/op_eval.go 50.00% 1 Missing ⚠️
tm2/pkg/bft/rpc/lib/server/handlers.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1592      +/-   ##
==========================================
- Coverage   55.80%   55.79%   -0.01%     
==========================================
  Files         436      436              
  Lines       66168    66156      -12     
==========================================
- Hits        36922    36913       -9     
+ Misses      26356    26355       -1     
+ Partials     2890     2888       -2     
Flag Coverage Δ
go-1.21.x ∅ <ø> (∅)
misc ∅ <ø> (∅)
misc-_test.genstd ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@zivkovicmilos zivkovicmilos 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 💯

@thehowl thehowl merged commit b93f590 into master Jan 31, 2024
187 of 189 checks passed
@thehowl thehowl deleted the dev/morgan/precompile-regex branch January 31, 2024 10:50
leohhhn pushed a commit to leohhhn/gno that referenced this pull request Feb 2, 2024
This PR changes all regexes (except for some in test files) in the code
to make them compile at init.

This, aside from giving a slight performance optimisation by skipping
the compile stage on execution, allows also to ensure that the regexes
themselves are correct by panicking at program start-up if they are not.
(before this PR, in almost every instance where we used
`regexp.MatchString` or similar, we did not check the error).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants