Skip to content

Instantly share code, notes, and snippets.

@hrkrshnn
Created August 24, 2021 15:36
Show Gist options
  • Save hrkrshnn/f7e6e69edfe62d5f94648a7b4f4abb26 to your computer and use it in GitHub Desktop.
Save hrkrshnn/f7e6e69edfe62d5f94648a7b4f4abb26 to your computer and use it in GitHub Desktop.
modified test/libsolidity/semanticTests/userDefinedValueType/erc20.sol
@@ -114,32 +114,32 @@ contract ERC20 {
// constructor()
// ~ emit Transfer(address,address,uint256): #0x00, #0x1212121212121212121212121212120000000012, 0x14
// gas irOptimized: 460447
-// gas legacy: 833310
-// gas legacyOptimized: 416135
+// gas legacy: 855430
+// gas legacyOptimized: 420959
// totalSupply() -> 20
// gas irOptimized: 23378
-// gas legacy: 23524
+// gas legacy: 23567
// gas legacyOptimized: 23368
// transfer(address,uint256): 2, 5 -> true
// ~ emit Transfer(address,address,uint256): #0x1212121212121212121212121212120000000012, #0x02, 0x05
// gas irOptimized: 48514
-// gas legacy: 49317
-// gas legacyOptimized: 48491
+// gas legacy: 49486
+// gas legacyOptimized: 48575
// decreaseAllowance(address,uint256): 2, 0 -> true
// ~ emit Approval(address,address,uint256): #0x1212121212121212121212121212120000000012, #0x02, 0x00
// gas irOptimized: 26316
-// gas legacy: 27012
-// gas legacyOptimized: 26275
+// gas legacy: 27118
+// gas legacyOptimized: 26317
// decreaseAllowance(address,uint256): 2, 1 -> FAILURE, hex"4e487b71", 0x11
// gas irOptimized: 24040
-// gas legacy: 24467
-// gas legacyOptimized: 24056
+// gas legacy: 24506
+// gas legacyOptimized: 24077
// transfer(address,uint256): 2, 14 -> true
// ~ emit Transfer(address,address,uint256): #0x1212121212121212121212121212120000000012, #0x02, 0x0e
// gas irOptimized: 28614
-// gas legacy: 29417
-// gas legacyOptimized: 28591
+// gas legacy: 29586
+// gas legacyOptimized: 28675
// transfer(address,uint256): 2, 2 -> FAILURE, hex"4e487b71", 0x11
// gas irOptimized: 24052
-// gas legacy: 24453
-// gas legacyOptimized: 24053
+// gas legacy: 24492
+// gas legacyOptimized: 24074
@hrkrshnn
Copy link
Author

The diff between erc20 using user defined value type v/s regular. My guess is that the gas difference is because of the library based safemath, which isn't getting inlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment