I See some very weird solc behaviour with regards to compiled bytecode size. A much shorter contract compiles to bigger byte code.

short contract: compiles into 439 bytes. while this longer one compiles into 129 bytes. note that the longer contract includes the code of the shorter one plus some extra code.

not sure what am I missing.

1 Answer 1


Thank to Kamil Śliwak that replied to me on the solidity gitter channel.

reason is the longer contract has only internal functions which the optimizer will remove out of the deployed bytecode. must call the functions of switch to external in order to check bytecode size effects.

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.