Do Empty spaces/text slow down code?

  • Thread starter Jarfi
  • Start date
  • Tags Tags
    Code Empty
1 reply · 1K views · last reply
Jarfi
Messages
384
Reaction score
12
If you are say running a for-loop with 5000 cycles, will 2 empty spaces and say 3-comments slow this operation down?
 
In general, no.

There are two methods of execution compile and run where code is converted to machine code and then run. This is the fastest option used for C/C++, Fortran...

The second method is interpretive where each line is tokenized and the tokens are processed and run:

http://en.wikipedia.org/wiki/Interpreter_(computing)

If your spaces were within quotes and were being printed each time then that would slow things down very very slightly. The more data you process the longer it takes a program to run.

However, in interpretive or compiled languages the spaces are removed from consideration as the code is converted to a more executable format.
 
  • Like
Likes   Reactions: elusiveshame