0

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

1

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

0

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 :)

0

Your Answer

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

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