Does lenght of code in C++ affect on speed of executing program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Does lenght of code in C++ affect on speed of executing program?

18th Feb 2018, 6:50 PM
kantarevic7
kantarevic7 - avatar
3 Answers
+ 3
No. The complexity determines how fast a program runs. Actually good timing for your questions, because I just made a comparison of 2 algorithms which get the same data and produce the same result, but have different complexities. https://code.sololearn.com/c9Zw3SPns8Ta/?ref=app
18th Feb 2018, 7:02 PM
Alex
Alex - avatar
+ 2
It can, code is stored stored via icache, which has to be fetched and is of limited capacity, the longer the code the more likely you will get icache misses, especially with unpredictable branches.
18th Feb 2018, 10:25 PM
aklex
aklex - avatar
+ 1
Thanks for the answer. That's what I've been looking for. Thumbs up!
18th Feb 2018, 7:06 PM
kantarevic7
kantarevic7 - avatar