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(gas-report): run gas report with --isolate #2331

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smart-actors-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/gas-report": minor
---

Now uses `--isolate` flag in `forge test` for more accurate gas measurement.
2 changes: 1 addition & 1 deletion packages/gas-report/README.md
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ pnpm gas-report --save gas-report.json
Or, if you have your own test command, you can pipe the output to `gas-report --stdin`:

```console
GAS_REPORTER_ENABLED=true forge test -vvv | pnpm gas-report --stdin
GAS_REPORTER_ENABLED=true forge test -vvv --isolate | pnpm gas-report --stdin
```

Run `pnpm gas-report --help` for more details.
2 changes: 1 addition & 1 deletion packages/gas-report/ts/index.ts
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ async function runGasReport(options: Options): Promise<GasReport> {
console.log("Done reading stdin");
} else {
// Run the default test command to capture the logs
const child = execa("forge", ["test", "-vvv"], {
const child = execa("forge", ["test", "-vvv", "--isolate"], {
stdio: ["inherit", "pipe", "inherit"],
env: { GAS_REPORTER_ENABLED: "true" },
});
22 changes: 11 additions & 11 deletions packages/store/gas-report.json
Original file line number Diff line number Diff line change
@@ -147,13 +147,13 @@
"file": "test/Gas.t.sol",
"test": "testCompareAbiEncodeVsCustom",
"name": "pass abi encoded bytes to external contract",
"gasUsed": 6549
"gasUsed": 29493
},
{
"file": "test/Gas.t.sol",
"test": "testCompareAbiEncodeVsCustom",
"name": "pass custom encoded bytes to external contract",
"gasUsed": 1426
"gasUsed": 23310
},
{
"file": "test/Gas.t.sol",
@@ -675,7 +675,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testDeleteDataOffchainTable",
"name": "StoreCore: delete record in offchain table",
"gasUsed": 4277
"gasUsed": 28225
},
{
"file": "test/StoreCoreGas.t.sol",
@@ -711,19 +711,19 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testHooks",
"name": "set record on table with subscriber",
"gasUsed": 70986
"gasUsed": 98286
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooks",
"name": "set static field on table with subscriber",
"gasUsed": 19248
"gasUsed": 52904
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooks",
"name": "delete record on table with subscriber",
"gasUsed": 17197
"gasUsed": 47489
},
{
"file": "test/StoreCoreGas.t.sol",
@@ -735,19 +735,19 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testHooksDynamicData",
"name": "set (dynamic) record on table with subscriber",
"gasUsed": 164119
"gasUsed": 191643
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooksDynamicData",
"name": "set (dynamic) field on table with subscriber",
"gasUsed": 24430
"gasUsed": 60374
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooksDynamicData",
"name": "delete (dynamic) record on table with subscriber",
"gasUsed": 18862
"gasUsed": 49266
},
{
"file": "test/StoreCoreGas.t.sol",
@@ -903,7 +903,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetDataOffchainTable",
"name": "StoreCore: set record in offchain table",
"gasUsed": 7681
"gasUsed": 32517
},
{
"file": "test/StoreCoreGas.t.sol",
@@ -921,7 +921,7 @@
"file": "test/StoreHook.t.sol",
"test": "testCallHook",
"name": "call an enabled hook",
"gasUsed": 15032
"gasUsed": 37660
},
{
"file": "test/StoreHook.t.sol",
Loading
Loading