-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new gas cost measurement scripts and integration
- Loading branch information
1 parent
5f1ea31
commit b3f9fd7
Showing
6 changed files
with
77 additions
and
29 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
pallet/src/assets/move-projects/gas-costs/sources/ModuleNotModule.move
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
script { | ||
fun uses_no_module() { | ||
let a: u64 = 0; | ||
let sum: u64 = 0; | ||
let cnt = 0; | ||
|
||
while (cnt < 5000) { | ||
a = a + 1; | ||
sum = sum + a; | ||
cnt = cnt + 1; | ||
}; | ||
|
||
assert!(sum > 5000, 0); | ||
} | ||
} | ||
|
||
script { | ||
use DeveloperBob::TheModule; | ||
|
||
fun uses_module() { | ||
let a: u64 = 0; | ||
let sum: u64 = 0; | ||
let cnt = 0; | ||
|
||
while (cnt < 5000) { | ||
(sum, a) = TheModule::stupid_algorithm(sum, a); | ||
cnt = cnt + 1; | ||
}; | ||
|
||
assert!(sum > 5000, 0); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
pallet/src/assets/move-projects/gas-costs/sources/TheModule.move
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module DeveloperBob::TheModule { | ||
// Useless algorithm to test difference between function calls and direct implementation. | ||
public fun stupid_algorithm(sum: u64, a: u64): (u64, u64) { | ||
a = a + 1; | ||
sum = sum + a; | ||
return (sum, a) | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
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