Skip to content

Commit

Permalink
use snapLastCall and isolate for posm benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint committed Jun 13, 2024
1 parent c8ce67b commit da91136
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddInitialLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
311137
354433
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122946
161742
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeFirstSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80287
146467
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeInitialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1015181
1037821
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
110544
146372
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
240022
281650
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSecondSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45997
116177
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
79418
145886
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow10Slots.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
232960
254164
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow10SlotsCardinalityGreater.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
223649
249653
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow1Slot.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
32845
54049
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow1SlotCardinalityGreater.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23545
49549
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleInitialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51310
72794
2 changes: 1 addition & 1 deletion .forge-snapshots/TWAMMSubmitOrder.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122359
156851
2 changes: 1 addition & 1 deletion .forge-snapshots/decreaseLiquidity_erc20.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
114609
187091
2 changes: 1 addition & 1 deletion .forge-snapshots/decreaseLiquidity_erc6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
112540
166084
2 changes: 1 addition & 1 deletion .forge-snapshots/increaseLiquidity_erc20.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
74128
187781
2 changes: 1 addition & 1 deletion .forge-snapshots/increaseLiquidity_erc6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
77920
163384
2 changes: 1 addition & 1 deletion .forge-snapshots/mintWithLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
475866
485624
17 changes: 6 additions & 11 deletions test/position-managers/Gas.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,45 +80,40 @@ contract GasTest is Test, Deployers, GasSnapshot {
// });
// snapStart("mint");
// lpm.mint(params);
// snapEnd();
// snapLastCall();
// }

function test_gas_mintWithLiquidity() public {
snapStart("mintWithLiquidity");
lpm.mint(range, 10_000 ether, block.timestamp + 1, address(this), ZERO_BYTES);
snapEnd();
snapLastCall("mintWithLiquidity");
}

function test_gas_increaseLiquidity_erc20() public {
(uint256 tokenId,) = lpm.mint(range, 10_000 ether, block.timestamp + 1, address(this), ZERO_BYTES);

snapStart("increaseLiquidity_erc20");
lpm.increaseLiquidity(tokenId, 1000 ether, ZERO_BYTES, false);
snapEnd();
snapLastCall("increaseLiquidity_erc20");
}

function test_gas_increaseLiquidity_erc6909() public {
(uint256 tokenId,) = lpm.mint(range, 10_000 ether, block.timestamp + 1, address(this), ZERO_BYTES);

snapStart("increaseLiquidity_erc6909");
lpm.increaseLiquidity(tokenId, 1000 ether, ZERO_BYTES, true);
snapEnd();
snapLastCall("increaseLiquidity_erc6909");
}

function test_gas_decreaseLiquidity_erc20() public {
(uint256 tokenId,) = lpm.mint(range, 10_000 ether, block.timestamp + 1, address(this), ZERO_BYTES);

snapStart("decreaseLiquidity_erc20");
lpm.decreaseLiquidity(tokenId, 10_000 ether, ZERO_BYTES, false);
snapEnd();
snapLastCall("decreaseLiquidity_erc20");
}

function test_gas_decreaseLiquidity_erc6909() public {
(uint256 tokenId,) = lpm.mint(range, 10_000 ether, block.timestamp + 1, address(this), ZERO_BYTES);

snapStart("decreaseLiquidity_erc6909");
lpm.decreaseLiquidity(tokenId, 10_000 ether, ZERO_BYTES, true);
snapEnd();
snapLastCall("decreaseLiquidity_erc6909");
}

function test_gas_burn() public {}
Expand Down

0 comments on commit da91136

Please sign in to comment.