0

Does the size of a contract increase CPU consumption in general?

To my knowledge, there may be several secondary factors that slow down the processing of transactions.

For example, a memcpy command consumes more CPU cycles with increasing size and, if I remember correctly, a contract is also copied via memcpy before the context is created.

Are there other factors (purely related to the size of the contract) and how big is their impact on CPU consumption?

0

Probably not. A contract loaded by a node is just a block of bytecode that's already in RAM. When you execute an action on a contract, there will be a lookup operation that will find the RAM address within the bytecode where the invoked action starts. Since the CPU jumps right into the point of interest, it doesn't matter what's the total size of the contract bytecode that contains the action you invoked.

CPU is paid during the setcode action which deploys the bytecode, so I guess if there's a CPU cost to be paid that depends on the contract's bytecode size, it will be when you deploy it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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