1

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?

1 Answer 1

1

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.

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.