Eosio is a very powerful platform for developers, but resources seems to be precious, especially ram and cpu. Regarding to cpu time, what programming practices are commonly used in other platforms but should be avoided inside a smart contract because could be high cpu consuming?

For example, loops is the most basic example that comes to my mind. Looping large sequences of data would require time. What other practices should we avoid?

2 Answers 2


In my Option a few things to avoid/to watch out for are: - sending inline-actions and actions - intensive mathematical calculations - cryptografic functions (also intense mathematical calculations) - heavy iterations, long running loops - string manipulation - working with floating-points


Dan published a really great article about Developing Efficient Contracts

You can actually read about the problems with Betdice dApp and how the usage of CPU can be reduced with a few optimizations :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.