diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-02-13 21:56:27 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-02-13 21:56:27 +0800 |
commit | 14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858 (patch) | |
tree | 00326daa802c98e20e95a33693fbfbd5e95fee1f | |
parent | 238d7ccc014ba91488b2e33740e8479ebe969c10 (diff) | |
download | dexon-solidity-14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858.tar.gz dexon-solidity-14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858.tar.zst dexon-solidity-14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858.zip |
Performance tests: more ackermann calls, fibonacci.
- ackermann(3, 1)
- ackermann(3, 2)
- fibonacci(10)
- fibonacci(16)
Contract code included: PerformanceTester.sol
-rw-r--r-- | PerformaceTester.sol | 17 | ||||
-rw-r--r-- | vmPerformanceTestFiller.json | 131 |
2 files changed, 137 insertions, 11 deletions
diff --git a/PerformaceTester.sol b/PerformaceTester.sol new file mode 100644 index 00000000..3b1202ce --- /dev/null +++ b/PerformaceTester.sol @@ -0,0 +1,17 @@ +contract PerformanceTester { + function ackermann(uint m, uint n) returns (uint) { + if (m == 0) + return n + 1; + + if (n == 0) + return ackermann(m - 1, 1); + + return ackermann(m - 1, ackermann(m, n - 1)); + } + + function fibonacci(uint n) returns (uint) { + if (n == 0 || n == 1) + return n; + return fibonacci(n - 1) + fibonacci(n - 2); + } +}
\ No newline at end of file diff --git a/vmPerformanceTestFiller.json b/vmPerformanceTestFiller.json index 7cfe659d..3292916e 100644 --- a/vmPerformanceTestFiller.json +++ b/vmPerformanceTestFiller.json @@ -1,4 +1,62 @@ { + "ackermann31": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "100000000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "//" : "PerformanceTester.sol", + "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "//" : "ackermann(3, 1)", + "data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001", + "gasPrice" : "100000000000000", + "gas" : "10000" + } + }, + "ackermann32": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "100000000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "//" : "PerformanceTester.sol", + "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "//" : "ackermann(3, 2)", + "data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002", + "gasPrice" : "100000000000000", + "gas" : "100000" + } + }, "ackermann33": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", @@ -12,16 +70,8 @@ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "balance" : "1000000000000000000", "nonce" : "0", - "//" : "contract PerformanceTester {", - "//" : " function ackermann(uint m, uint n) returns (uint) {", - "//" : " if (m == 0)", - "//" : " return n + 1;", - "//" : " if (n == 0)", - "//" : " return ackermann(m - 1, 1);", - "//" : " return ackermann(m - 1, ackermann(m, n - 1));", - "//" : " }", - "//" : "}", - "code" : "0x60e060020a6000350480632839e92814601457005b6020600435602435602a565b8060005260206000f35b6000826000146037576041565b8160010190506076565b81600014604c57605e565b6058600184036001602a565b90506076565b607360018403606f8560018603602a565b602a565b90505b9291505056", + "//" : "PerformanceTester.sol", + "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", "storage": {} } }, @@ -30,9 +80,68 @@ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000", + "//" : "ackermann(3, 3)", "data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003", "gasPrice" : "100000000000000", - "gas" : "100000000000" + "gas" : "100000" + } + }, + "fibonacci10": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "100000000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "//" : "PerformanceTester.sol", + "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "//" : "fibonacci(10)", + "data" : "0x61047ff4000000000000000000000000000000000000000000000000000000000000000a", + "gasPrice" : "100000000000000", + "gas" : "100000" + } + }, + "fibonacci16": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "100000000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "//" : "PerformanceTester.sol", + "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "//" : "fibonacci(16)", + "data" : "0x61047ff40000000000000000000000000000000000000000000000000000000000000010", + "gasPrice" : "100000000000000", + "gas" : "100000000" } } } |