Procedures cut exe size?
Posted: Sun Nov 20, 2011 11:13 pm
I had an interesting thing happen today. I have a program that is around 400 lines with a datasection containing about 30k or so of graphics. The structure of the program was all inline code with If-ElseIf-ElseIf-ElseIf-Endif to choose which code to run based on the mode found in the program parameters. It compiled to around 147k for the exe size. Once I was happy with the way the code ran, I restructured the program so that each of the code sections was in its own procedure and all the If-ElseIf block did was choose which procedure to run and then end. The code itself changed very little, nothing significant was removed. But after the restructure, the compiled exe size went down to 115k from 147.
Has anyone else noticed similar? And if this is something to be expected, can someone shed some light on why? I'm flummoxed as to why this would be.
Has anyone else noticed similar? And if this is something to be expected, can someone shed some light on why? I'm flummoxed as to why this would be.