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

feat(gnovm): gno test now has gas used information #2571

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

thinhnx-var
Copy link
Contributor

@thinhnx-var thinhnx-var commented Jul 10, 2024

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

Why do we have this PR?

After discussion in #2467 and #2149 that the gno test now has gas used information instead of execution time.

Target:

  • gno test has total gas used information
  • gno test has gas used for each xxx_filetest.gno

I will add realm storage diff size #2468 in another PR.

  • image
  • image

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jul 10, 2024
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 84.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gnovm/tests/file.go 72.72% 3 Missing ⚠️
gnovm/cmd/gno/test.go 92.85% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@linhpn99
Copy link
Contributor

If the gas used for each test case is displayed, that would be great :)

@linhpn99
Copy link
Contributor

If the gas used for each test case is displayed, that would be great :)

And it would be even better if we displayed both the execution time and the gas used :)

Copy link
Contributor

@deelawn deelawn left a comment

Choose a reason for hiding this comment

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

Nice idea. Some style comments and also -- are also those lines supposed to commented out?

gnovm/cmd/gno/test.go Outdated Show resolved Hide resolved
gnovm/tests/file_test.go Outdated Show resolved Hide resolved
gnovm/tests/file.go Outdated Show resolved Hide resolved
gnovm/tests/file.go Show resolved Hide resolved
gnovm/tests/file.go Outdated Show resolved Hide resolved
@@ -205,7 +206,7 @@ func execTest(cfg *testCfg, args []string, io commands.IO) error {
io.ErrPrintfln("FAIL")
testErrCount++
} else {
io.ErrPrintfln("ok %s \t%s", pkg.Dir, dstr)
io.ErrPrintfln("ok %s \ttotal gas used: %d", pkg.Dir, gasUsed)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we have both gas used and duration? Both seem useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that people are not often concern about that time so much.

Copy link
Contributor

@deelawn deelawn Jul 23, 2024

Choose a reason for hiding this comment

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

I'll ask in another way -- how do we benefit from removing it? If someone doesn't care about it then they don't have to use it. If someone does care about it then they have it. It's only a few more characters being printed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@deelawn
I am fine with keeping the duration to be displayed.
But I have another view, should we move duration to -print-runtime-metrics which currently displaying runtime: cycle=%s imports=%d allocs=%s?

Copy link
Contributor

Choose a reason for hiding this comment

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

Before these changes, only subpackage level test execution displayed duration. The runtime metrics are something different. I'm only suggesting that we don't remove existing functionality if there is no good reason to do so. I don't think duration needs to be added anywhere else it doesn't currently exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right 👍 . I re-added the executing duration back again.
The result now looks like this:
image

gnovm/cmd/gno/test.go Outdated Show resolved Hide resolved
gnovm/cmd/gno/test.go Outdated Show resolved Hide resolved
gnovm/stdlibs/testing/testing.gno Outdated Show resolved Hide resolved
@thinhnx-var
Copy link
Contributor Author

Thanks for reviewing with so much details.
About displaying gasUsed instead of duration, I think people seems to not concern about the duration so much. I am not sure about this :)
Do you have any idea about removing or keeping this duration ?
cc to @moul @deelawn

@thinhnx-var thinhnx-var force-pushed the dev-thinhnx/feat_gno_test_has_gasused branch from 5a85bec to 0cc91ce Compare August 11, 2024 03:46
@Kouteki Kouteki added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 3, 2024
@Kouteki Kouteki removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 4, 2024
@moul moul requested a review from ltzmaxwell December 28, 2024 20:59
@moul
Copy link
Member

moul commented Dec 28, 2024

This PR could be useful as we are currently dogfooding more and adding new data structures, such as btree, ulist, and AVL alternatives.

@thehowl @ltzmaxwell, could you review this PR and share your thoughts on whether we should continue with it or consider a different implementation? After that, we can check if the original author is willing to update it or if we should find someone else to continue the work. Thank you.

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 28, 2024

🛠 PR Checks Summary

🔴 Maintainers must be able to edit this pull request (more info)

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🔴 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: VAR-META-Tech/gno)

Then

🔴 Requirement not satisfied
└── 🔴 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)

Can be checked by

  • team core-contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: In Progress
Status: In Review
Development

Successfully merging this pull request may close these issues.

6 participants