ガスコスト比較。Auctions
構造体のネーミングをミスった。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
pragma solidity ^0.4.18; contract Store { struct SaleAuctionSmallPrice { address seller; uint128 startPrice; uint128 endPrice; uint32 startTimeSec; uint32 durationSec; uint32 auctionId; } struct SaleAuctionBigPrice { address seller; uint startPrice; uint endPrice; uint32 startTimeSec; uint32 durationSec; uint32 auctionId; } struct SaleAuctionBigPriceSmallId { address seller; uint128 startPrice; uint128 endPrice; uint32 startTimeSec; uint32 durationSec; uint8 auctionId; } struct SaleAuctionSmallPriceSmallId { address seller; uint128 startPrice; uint128 endPrice; uint32 startTimeSec; uint32 durationSec; uint8 auctionId; } mapping(address => SaleAuctionSmallPrice ) a; mapping(address => SaleAuctionBigPrice ) b; mapping(address => SaleAuctionBigPriceSmallId ) c; mapping(address => SaleAuctionSmallPriceSmallId ) d; function updateA() public { a[msg.sender].seller = msg.sender; a[msg.sender].startPrice++; a[msg.sender].endPrice++; a[msg.sender].startTimeSec++; a[msg.sender].durationSec++; a[msg.sender].auctionId++; } function updateB() public { b[msg.sender].seller = msg.sender; b[msg.sender].startPrice++; b[msg.sender].endPrice++; b[msg.sender].startTimeSec++; b[msg.sender].durationSec++; b[msg.sender].auctionId++; } function updateC() public { c[msg.sender].seller = msg.sender; c[msg.sender].startPrice++; c[msg.sender].endPrice++; c[msg.sender].startTimeSec++; c[msg.sender].durationSec++; c[msg.sender].auctionId++; } function updateD() public { d[msg.sender].seller = msg.sender; d[msg.sender].startPrice++; d[msg.sender].endPrice++; d[msg.sender].startTimeSec++; d[msg.sender].durationSec++; d[msg.sender].auctionId++; } } |
1 2 3 4 5 |
メソッド 1回目 2回目 3回目 updateA 100225 55225 55225 updateB 114497 54497 54497 updateC 100203 55203 55203 updateD 100247 55247 55247 |
ありがとうございました。viagra pills