-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57eb904
commit ed8e28e
Showing
13 changed files
with
674 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -1,6 +1,16 @@ | ||
[settings] | ||
main = "str-repeat" | ||
|
||
# the only purpose of this config is to specify the allocator | ||
[contracts.str-repeat] | ||
allocator = "leaking" | ||
|
||
[contracts.str-repeat-mb-builder-basic] | ||
add-unlabelled = false | ||
add-labels = ["mb-builder"] | ||
add-endpoints = ["init"] | ||
|
||
[contracts.str-repeat-mb-builder-cached] | ||
add-unlabelled = false | ||
add-labels = ["mb-builder"] | ||
add-endpoints = ["init"] | ||
features = ["managed-buffer-builder-cached"] |
80 changes: 80 additions & 0 deletions
80
contracts/benchmarks/str-repeat/scenarios/mb_builder_basic.scen.json
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,80 @@ | ||
{ | ||
"name": "str-repeat", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"address:owner": { | ||
"nonce": "0", | ||
"balance": "0" | ||
}, | ||
"sc:contract": { | ||
"code": "mxsc:../output/str-repeat-mb-builder-basic.mxsc.json" | ||
} | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "benchmark-mb-builder-basic-10", | ||
"comment": "code is smaller, so basic wins here", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "mb_builder_benchmark", | ||
"arguments": [ | ||
"0x01020304", | ||
"10" | ||
], | ||
"gasLimit": "10,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": "*", | ||
"status": "", | ||
"gas": "8855882" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "benchmark-mb-builder-basic-tipping-point", | ||
"comment": "the caching optimization starts to compensate the larger code size", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "mb_builder_benchmark", | ||
"arguments": [ | ||
"0x01020304", | ||
"22" | ||
], | ||
"gasLimit": "10,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": "*", | ||
"status": "", | ||
"gas": "8778242" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "benchmark-mb-builder-basic", | ||
"comment": "for many repeats, the cached version wins", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "mb_builder_benchmark", | ||
"arguments": [ | ||
"0x01020304", | ||
"10000" | ||
], | ||
"gasLimit": "10,000,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": "*", | ||
"status": "", | ||
"gas": "9934220582" | ||
} | ||
} | ||
] | ||
} |
80 changes: 80 additions & 0 deletions
80
contracts/benchmarks/str-repeat/scenarios/mb_builder_cached.scen.json
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,80 @@ | ||
{ | ||
"name": "str-repeat", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"address:owner": { | ||
"nonce": "0", | ||
"balance": "0" | ||
}, | ||
"sc:contract": { | ||
"code": "mxsc:../output/str-repeat-mb-builder-cached.mxsc.json" | ||
} | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "benchmark-mb-builder-cached-10", | ||
"comment": "code is smaller, so basic wins here", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "mb_builder_benchmark", | ||
"arguments": [ | ||
"0x01020304", | ||
"10" | ||
], | ||
"gasLimit": "10,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": "*", | ||
"status": "", | ||
"gas": "8834532" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "benchmark-mb-builder-cached-tipping-point", | ||
"comment": "the caching optimization starts to compensate the larger code size", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "mb_builder_benchmark", | ||
"arguments": [ | ||
"0x01020304", | ||
"22" | ||
], | ||
"gasLimit": "10,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": "*", | ||
"status": "", | ||
"gas": "8779332" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "benchmark-mb-builder-cached", | ||
"comment": "for many repeats, the cached version wins", | ||
"tx": { | ||
"from": "address:owner", | ||
"to": "sc:contract", | ||
"function": "mb_builder_benchmark", | ||
"arguments": [ | ||
"0x01020304", | ||
"10000" | ||
], | ||
"gasLimit": "10,000,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": "*", | ||
"status": "", | ||
"gas": "9938367902" | ||
} | ||
} | ||
] | ||
} |
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 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 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
Oops, something went wrong.