From 775f3e6dff734bd25b5b65609480bf9d434c8c07 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Fri, 23 Dec 2016 17:42:17 +0100 Subject: Add performance VM tests for MULMOD --- src/VMTestsFiller/loop-mul.sol | 12 +++++++++++ src/VMTestsFiller/vmPerformanceTestFiller.json | 28 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'src/VMTestsFiller') 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" : { -- cgit