Ref this thread:
https://vexforum.com/showthread.php?p=178264#post178264
OP question:
EasyC official answer:
My experimental results: EasyCv4 for Cortex
- Take a large existing program, call an existing function 10 times in a row, compile, check size of HEX file (151k)
- Delete the 10 function calls, replace with 10 copies of the function code inserted in-line, compile, check size of HEX file (157k)
By my parsing of the OP: modules are only downloaded once,
Using modules/subroutines makes your code smaller than the alternative of copying the same code in-line a bunch of times.
what if a function has only one line in it? (channel 6 = motor port7)
is it still worth the trouble? (say the function was called a total of 4 times throughout the program)
or does something that small shouldn’t even matter?
Thats pretty small.
I described my experiemental method for EasyC, so you can answer for yourself.
For RobotC, its even easier, just use the f9 key to see the byte-compiled-code for each C line.
There is (usually) both performance overhead, and size overhead for calling a routine just once. For code clarity, it is sometimes still useful to put code in a function and call it, even if it is used just once. For example, If you have 6 different autonomous routines, you can have a short chooser code that decides which routine to call, then describe each routine in its own block.