Inner loop program construct: A faster way for program execution

4Citations
Citations of this article
10Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Loops are repetitive control structures in programming languages. They are used extensively in many algorithms. The for-loop and while-loop exist, where the former is repeated a number of times while the latter is repeated until a condition is met. Some have asked if re-arranging loops in certain ways can change a program's speed to produce machine-independent optimisation. Therefore, this research sought to find out if there is any speed difference in a single loop of computations and a loop with an inner loop of same computations. Greater focus is on inner for-loop. The research used a comparative study method in order to evaluate the primary data obtained from running several tests in four popular programming languages: C, C#, Python and R. The Python implementations were further tested on Ubuntu 16 for comparison with results fromWindows 10. Results established that, across all languages, there were more computations performed per unit time with an inner for-loop than no inner loop, meaning, given the same number of computations to perform, a loop with an inner for-loop will finish faster. The innerwhile-loop didn't perform sowell, though. This study will help developers in making better choices with programming language and style.

Cite

CITATION STYLE

APA

Adewumi, T. P. (2018). Inner loop program construct: A faster way for program execution. Open Computer Science, 8(1), 115–122. https://doi.org/10.1515/comp-2018-0004

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free