aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2016-12-24 00:42:17 +0800
committerPaweł Bylica <chfast@gmail.com>2016-12-24 00:42:17 +0800
commit775f3e6dff734bd25b5b65609480bf9d434c8c07 (patch)
tree20ce2930161b606b1f348d4f46db82029d01205a
parentb364958d2f4828ac9165ae90eade97d57a52ecba (diff)
downloaddexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.tar
dexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.tar.gz
dexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.tar.bz2
dexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.tar.lz
dexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.tar.xz
dexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.tar.zst
dexon-tests-775f3e6dff734bd25b5b65609480bf9d434c8c07.zip
Add performance VM tests for MULMOD
-rw-r--r--VMTests/vmPerformanceTest.json44
-rw-r--r--src/VMTestsFiller/loop-mul.sol12
-rw-r--r--src/VMTestsFiller/vmPerformanceTestFiller.json28
3 files changed, 84 insertions, 0 deletions
diff --git a/VMTests/vmPerformanceTest.json b/VMTests/vmPerformanceTest.json
index e3bc42f28..2efd29a34 100644
--- a/VMTests/vmPerformanceTest.json
+++ b/VMTests/vmPerformanceTest.json
@@ -550,6 +550,50 @@
}
}
},
+ "loop-mulmod-2M" : {
+ "//" : "loop-mul.sol: MulPerformanceTester.testMulMod(..., ..., 2^256-1, 2000000)",
+ "callcreates" : [
+ ],
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "0x4e20",
+ "currentGasLimit" : "0x174876e800",
+ "currentNumber" : "0x270f",
+ "currentTimestamp" : "0x01"
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "code" : "0x606060405263ffffffff60e060020a60003504166315d4232781146022575b6000565b346000576038600435602435604435606435604a565b60408051918252519081900360200190f35b600084815b838110156064578486830991505b600101604f565b8192505b50509493505050505600a165627a7a723058200b2f52fbc8327bac47da1762338f70ad17310de956a58bbbca8ee58378f357900029",
+ "data" : "0x15d423278edad8b55b1586805ea8c245d8c16b06a5102b791fc6eb60693731c0677bf5011c68db1c179cd35ab3fc60c63704aa7fcbea40f19782b1611aaba86726a7686cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000001e8480",
+ "gas" : "0xe8d4a51000",
+ "gasPrice" : "0x5af3107a4000",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "0x00"
+ },
+ "gas" : "0xe8ccc6e601",
+ "logs" : [
+ ],
+ "out" : "0x0e1c6aac6663c379a52d9ccc7ba4757131020772d41447dfcf478cf9fb0c2bbf",
+ "post" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "0x152d02c7e14af6800000",
+ "code" : "0x606060405263ffffffff60e060020a60003504166315d4232781146022575b6000565b346000576038600435602435604435606435604a565b60408051918252519081900360200190f35b600084815b838110156064578486830991505b600101604f565b8192505b50509493505050505600a165627a7a723058200b2f52fbc8327bac47da1762338f70ad17310de956a58bbbca8ee58378f357900029",
+ "nonce" : "0x00",
+ "storage" : {
+ }
+ }
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "0x152d02c7e14af6800000",
+ "code" : "0x606060405263ffffffff60e060020a60003504166315d4232781146022575b6000565b346000576038600435602435604435606435604a565b60408051918252519081900360200190f35b600084815b838110156064578486830991505b600101604f565b8192505b50509493505050505600a165627a7a723058200b2f52fbc8327bac47da1762338f70ad17310de956a58bbbca8ee58378f357900029",
+ "nonce" : "0x00",
+ "storage" : {
+ }
+ }
+ }
+ },
"manyFunctions100" : {
"callcreates" : [
],
diff --git a/src/VMTestsFiller/loop-mul.sol b/src/VMTestsFiller/loop-mul.sol
index e69de29bb..a7780c670 100644
--- a/src/VMTestsFiller/loop-mul.sol
+++ b/src/VMTestsFiller/loop-mul.sol
@@ -0,0 +1,12 @@
+pragma solidity ^0.4.0;
+
+contract MulPerformanceTester {
+
+ function testMulMod(uint x, uint y, uint k, uint n) external returns (uint) {
+ var r = x;
+ for (uint i = 0; i < n; i += 1) {
+ r = mulmod(r, y, k);
+ }
+ return r;
+ }
+}
diff --git a/src/VMTestsFiller/vmPerformanceTestFiller.json b/src/VMTestsFiller/vmPerformanceTestFiller.json
index fe788239e..bc045fea8 100644
--- a/src/VMTestsFiller/vmPerformanceTestFiller.json
+++ b/src/VMTestsFiller/vmPerformanceTestFiller.json
@@ -200,6 +200,34 @@
"gas" : "1000000000000"
}
},
+ "loop-mulmod-2M": {
+ "//" : "loop-mul.sol: MulPerformanceTester.testMulMod(..., ..., 2^256-1, 2000000)",
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "9999",
+ "currentGasLimit" : "100000000000",
+ "currentDifficulty" : "20000",
+ "currentTimestamp" : "1",
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
+ "balance" : "100000000000000000000000",
+ "nonce" : "0",
+ "code" : "0x606060405263ffffffff60e060020a60003504166315d4232781146022575b6000565b346000576038600435602435604435606435604a565b60408051918252519081900360200190f35b600084815b838110156064578486830991505b600101604f565b8192505b50509493505050505600a165627a7a723058200b2f52fbc8327bac47da1762338f70ad17310de956a58bbbca8ee58378f357900029",
+ "storage": {}
+ }
+ },
+ "exec" : {
+ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
+ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
+ "value" : "0",
+ "data" : "0x15d423278edad8b55b1586805ea8c245d8c16b06a5102b791fc6eb60693731c0677bf5011c68db1c179cd35ab3fc60c63704aa7fcbea40f19782b1611aaba86726a7686cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000001e8480",
+ "gasPrice" : "100000000000000",
+ "gas" : "1000000000000"
+ }
+ },
"loop-exp-nop-1M": {
"//" : "loop-exp.sol: ExpPerformanceTester.testNop(0, 15, 1000000)",
"env" : {