# Increase the speed of Smart Contract blockchain updates

for example

pragma solidity ^0.4.18;

contract charity_tab{

string [] public charity;
uint public charitySize=0;

charity.push(a);
charitySize++;
}
}


This contract to add a data time about 30-40 seconds, how to improve efficiency？

• How are you testing it? I checked on remix IDE and its getting executed instantly. If you are using any network, there might be the case that the mining the transaction is taking time. So you can increase the gas amount to make the mining fast. – Abhishek Dec 14 '17 at 3:28
• 12 transaction data using the above contract method to add, the time required for about 3 minutes, is this normal time? – J.JACK Dec 14 '17 at 3:46

Smart contracts are rather strange from a performance standpoint.

The Ethereum Virtual Machine is a state machine that updates with each block. A block contains a list of transactions that were included. This can include multiple/many transactions from the same sender. The new state is determined from the old state, plus whatever changes result from the transactions included in the block.

The included transactions may be trivial or complex and costly. This has no impact at all on timing. Transactions are either included in their entirety or they are not included at all. Either they happened or they did not.

There is a delay after sending a transaction until that transaction is included in a mined block. There is nothing one can do to speed that up. When a transaction is included in a block, the processing time can be considered more or less instant without any regard to how efficient the function is. Efficiency is encouraged economically . More complex transactions cost a little more.

The code looks fine.

Hope it helps.

• However, I still have another question. If two transactions are committed one second apart, can the two transactions be included together in a single block? My experiment proves that it seems that a transaction needs to be included in a block and the other A transaction can be included in another block – J.JACK Dec 14 '17 at 3:15
• Yes, two transactions from the same node can be included in the same block. It is not guaranteed that they will be mined together even if they are submitted more or less simultaneously. You can proceed on the understanding that they will be processed in the correct sequence in case transactions depend on the outcomes of previous transactions. Have a look over here for clarification: ethereum.stackexchange.com/questions/13376/… – Rob Hitchens - B9lab Dec 14 '17 at 4:47
• 12 transaction data using the above contract method to add, the time required for about 3 minutes, is this normal time? – J.JACK Dec 14 '17 at 5:37