-
Notifications
You must be signed in to change notification settings - Fork 378
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
perf: make debug a constant set using a build flag #2072
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2072 +/- ##
=======================================
Coverage 54.96% 54.96%
=======================================
Files 481 481
Lines 67407 67406 -1
=======================================
+ Hits 37049 37051 +2
+ Misses 27337 27336 -1
+ Partials 3021 3019 -2 ☔ View full report in Codecov by Sentry. |
piux2
approved these changes
May 29, 2024
omarsy
pushed a commit
to TERITORI/gno
that referenced
this pull request
Jun 3, 2024
Changing the `debug` flag from a variable to a constant results in increased performance anywhere in the code where the `if debug {` conditional exists. The setting of the debug flag is now facilitated by a `debug` build tag. Here are a few benchmarks showing the performance difference for TypedValue Set and Get operations. The benchmarks suffixed with 'New' are those run with debugging disabled after introducing the build tag. The other benchmarks were run with debugging disabled before introducing the build tag. ``` go test -cpu 1,2,4,8 -benchmem -bench '^BenchmarkTV' -run=^$ goos: darwin goarch: amd64 pkg: github.com/gnolang/gno/gnovm/pkg/gnolang cpu: Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz BenchmarkTVGetBool 616270255 1.919 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBool-2 623206738 1.859 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBool-4 645019149 1.825 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBool-8 628096153 1.897 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBoolNew 1000000000 0.3015 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBoolNew-2 1000000000 0.2997 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBoolNew-4 1000000000 0.3026 ns/op 0 B/op 0 allocs/op BenchmarkTVGetBoolNew-8 1000000000 0.3009 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBool 636429537 1.895 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBool-2 612271684 1.983 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBool-4 583097722 1.923 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBool-8 608042474 1.949 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBoolNew 1000000000 0.3109 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBoolNew-2 1000000000 0.3116 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBoolNew-4 1000000000 0.3101 ns/op 0 B/op 0 allocs/op BenchmarkTVSetBoolNew-8 1000000000 0.3080 ns/op 0 B/op 0 allocs/op BenchmarkTVGetInt 596222908 1.979 ns/op 0 B/op 0 allocs/op BenchmarkTVGetInt-2 565257805 2.024 ns/op 0 B/op 0 allocs/op BenchmarkTVGetInt-4 603462258 1.913 ns/op 0 B/op 0 allocs/op BenchmarkTVGetInt-8 623668717 1.896 ns/op 0 B/op 0 allocs/op BenchmarkTVGetIntNew 1000000000 0.3049 ns/op 0 B/op 0 allocs/op BenchmarkTVGetIntNew-2 1000000000 0.3035 ns/op 0 B/op 0 allocs/op BenchmarkTVGetIntNew-4 1000000000 0.3139 ns/op 0 B/op 0 allocs/op BenchmarkTVGetIntNew-8 1000000000 0.3006 ns/op 0 B/op 0 allocs/op BenchmarkTVSetInt 646375224 1.819 ns/op 0 B/op 0 allocs/op BenchmarkTVSetInt-2 639805758 1.817 ns/op 0 B/op 0 allocs/op BenchmarkTVSetInt-4 641337288 1.840 ns/op 0 B/op 0 allocs/op BenchmarkTVSetInt-8 636959119 1.836 ns/op 0 B/op 0 allocs/op BenchmarkTVSetIntNew 1000000000 0.3011 ns/op 0 B/op 0 allocs/op BenchmarkTVSetIntNew-2 1000000000 0.3017 ns/op 0 B/op 0 allocs/op BenchmarkTVSetIntNew-4 1000000000 0.2984 ns/op 0 B/op 0 allocs/op BenchmarkTVSetIntNew-8 1000000000 0.2909 ns/op 0 B/op 0 allocs/op ``` <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests - [x] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changing the
debug
flag from a variable to a constant results in increased performance anywhere in the code where theif debug {
conditional exists. The setting of the debug flag is now facilitated by adebug
build tag.Here are a few benchmarks showing the performance difference for TypedValue Set and Get operations. The benchmarks suffixed with 'New' are those run with debugging disabled after introducing the build tag. The other benchmarks were run with debugging disabled before introducing the build tag.
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description