aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2017-04-20 19:01:20 +0800
committerPaweł Bylica <chfast@gmail.com>2017-04-20 19:25:06 +0800
commit4afd869a5acd1ca1c8e5c0edd164a13648d47483 (patch)
treea5b7f4c46014b3a22cdabbf17ed7f85203e3d487 /src
parent4e8b9be3fba16ec32e0cdf50b8f9329826283aaa (diff)
downloadtangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.tar
tangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.tar.gz
tangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.tar.bz2
tangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.tar.lz
tangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.tar.xz
tangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.tar.zst
tangerine-tests-4afd869a5acd1ca1c8e5c0edd164a13648d47483.zip
Add VM performance tests for div+add and add
Diffstat (limited to 'src')
-rw-r--r--src/VMTestsFiller/loop-mul.sol25
-rw-r--r--src/VMTestsFiller/vmPerformanceTestFiller.json58
2 files changed, 83 insertions, 0 deletions
diff --git a/src/VMTestsFiller/loop-mul.sol b/src/VMTestsFiller/loop-mul.sol
index a7780c670..116970d48 100644
--- a/src/VMTestsFiller/loop-mul.sol
+++ b/src/VMTestsFiller/loop-mul.sol
@@ -9,4 +9,29 @@ contract MulPerformanceTester {
}
return r;
}
+
+ function testDivAdd(uint x, uint y, uint k, uint n) external returns (uint) {
+ var r = x;
+ for (uint i = 0; i < n; i += 1) {
+ r /= y;
+ r += k;
+ }
+ return r;
+ }
+
+ function testMul(uint x, uint y, uint n) external returns (uint) {
+ var r = x;
+ for (uint i = 0; i < n; i += 1) {
+ r *= y;
+ }
+ return r;
+ }
+
+ function testAdd(uint x, uint y, uint n) external returns (uint) {
+ var r = x;
+ for (uint i = 0; i < n; i += 1) {
+ r += y;
+ }
+ return r;
+ }
}
diff --git a/src/VMTestsFiller/vmPerformanceTestFiller.json b/src/VMTestsFiller/vmPerformanceTestFiller.json
index bc045fea8..6893913f0 100644
--- a/src/VMTestsFiller/vmPerformanceTestFiller.json
+++ b/src/VMTestsFiller/vmPerformanceTestFiller.json
@@ -228,6 +228,64 @@
"gas" : "1000000000000"
}
},
+ "loop-divadd-10M": {
+ "//" : "loop-mul.sol: MulPerformanceTester.testDivAdd(..., ..., ..., 10000000)",
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "9999",
+ "currentGasLimit" : "100000000000",
+ "currentDifficulty" : "20000",
+ "currentTimestamp" : "1",
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "100000000000000000000000",
+ "nonce" : "0",
+ "code" : "0x606060405263ffffffff60e060020a60003504166315d42327811461004257806359e3e1ea14610070578063c4f8b9fb1461009e578063e01330bb146100c9575bfe5b341561004a57fe5b61005e6004356024356044356064356100f4565b60408051918252519081900360200190f35b341561007857fe5b61005e60043560243560443560643561011e565b60408051918252519081900360200190f35b34156100a657fe5b61005e600435602435604435610152565b60408051918252519081900360200190f35b34156100d157fe5b61005e600435602435604435610179565b60408051918252519081900360200190f35b600084815b83811015610110578486830991505b6001016100f9565b8192505b5050949350505050565b600084815b8381101561011057858281151561013657fe5b04850191505b600101610123565b8192505b5050949350505050565b600083815b8381101561016c57908401905b600101610157565b8192505b50509392505050565b600083815b8381101561016c57908402905b60010161017e565b8192505b505093925050505600a165627a7a72305820065081bd1e9fdffccd251332523241eaabd0fb1881a06529599a9c67d0a568e50029",
+ "storage": {}
+ }
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "0",
+ "data" : "0x59e3e1ea8edad8b55b1586805ea8c245d8c16b06a5102b791fc6eb60693731c0677bf5011c68db1c179cd35ab3fc60c63704aa7fcbea40f19782b1611aaba86726a7686cff00ffffffffffffffffffffffffffaaffffffffffffffffbbffffffffffffff0000000000000000000000000000000000000000000000000000000000989680",
+ "gasPrice" : "100000000000000",
+ "gas" : "1000000000000"
+ },
+ "expectOut" : "0xff00ffffffffffffffffffffffffffaaffffffffffffffffbc00000000000007"
+ },
+ "loop-add-10M": {
+ "//" : "loop-mul.sol: MulPerformanceTester.testAdd(..., ..., 10000000)",
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "9999",
+ "currentGasLimit" : "100000000000",
+ "currentDifficulty" : "20000",
+ "currentTimestamp" : "1",
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "100000000000000000000000",
+ "nonce" : "0",
+ "code" : "0x606060405263ffffffff60e060020a60003504166315d42327811461004257806359e3e1ea14610070578063c4f8b9fb1461009e578063e01330bb146100c9575bfe5b341561004a57fe5b61005e6004356024356044356064356100f4565b60408051918252519081900360200190f35b341561007857fe5b61005e60043560243560443560643561011e565b60408051918252519081900360200190f35b34156100a657fe5b61005e600435602435604435610152565b60408051918252519081900360200190f35b34156100d157fe5b61005e600435602435604435610179565b60408051918252519081900360200190f35b600084815b83811015610110578486830991505b6001016100f9565b8192505b5050949350505050565b600084815b8381101561011057858281151561013657fe5b04850191505b600101610123565b8192505b5050949350505050565b600083815b8381101561016c57908401905b600101610157565b8192505b50509392505050565b600083815b8381101561016c57908402905b60010161017e565b8192505b505093925050505600a165627a7a72305820065081bd1e9fdffccd251332523241eaabd0fb1881a06529599a9c67d0a568e50029",
+ "storage": {}
+ }
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "0",
+ "data" : "0xc4f8b9fb8edad8b55b1586805ea8c245d8c16b06a5102b791fc6eb60693731c0677bf501ff00ffffffffffffffffffffffffffaaffffffffffffffffbbffffffffffffff0000000000000000000000000000000000000000000000000000000000989680",
+ "gasPrice" : "100000000000000",
+ "gas" : "1000000000000"
+ },
+ "expectOut" : "0xa55ad8b55b1586805ea8c245a6177286a5102b791f9e6366693731c066e35e81"
+ },
"loop-exp-nop-1M": {
"//" : "loop-exp.sol: ExpPerformanceTester.testNop(0, 15, 1000000)",
"env" : {