I have a function that iterate through an array, which could cost a lot of gas. But I still want to test out the estimate gas cost, then decide if I should maintain the design or not.
function giveAwayDividend(uint amount) onlyOwner payable {
for(uint i=0;i<size();i++){
customerAddress[i].call.value((balances[customerAddress[i]] * amount * 100) / totalSupply)();
}}
If I test out on testnet, I have to manually create over 1 thousand user account and send each of them some token, which seems stupid. Is there a better way to calculate the gas cost? For example, if the cost is linear, I could calculate the cost for one customer then multiple by the number of customers. Question is, I dont think its linear, can someone shed some light on this?