https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83262
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #42781|0 |1
is obsolete| |
--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 64471
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64471&action=edit
Updated test case
Here's an update on the test case.
Recent timings:
$ ./a.out 100000000 200000000 300000000
Number of input arguments: 3
GOTO: n =100000000, ss = 0.4321400E+10, time = 0.135 (s)
SELECT CASE: n =100000000, ss = 0.4321400E+10, time = 0.134 (s)
IF-Goto: n =100000000, ss = 0.4321400E+10, time = 0.133 (s)
IF-noGoto: n =100000000, ss =-0.1480800E+10, time = 0.082 (s)
IF-ELSE: n =100000000, ss =-0.1480800E+10, time = 0.082 (s)
GOTO: n =200000000, ss = 0.8642800E+10, time = 0.269 (s)
SELECT CASE: n =200000000, ss = 0.8642800E+10, time = 0.268 (s)
IF-Goto: n =200000000, ss = 0.8642800E+10, time = 0.266 (s)
IF-noGoto: n =200000000, ss =-0.2961600E+10, time = 0.164 (s)
IF-ELSE: n =200000000, ss =-0.2961600E+10, time = 0.164 (s)
GOTO: n =300000000, ss = 0.1296420E+11, time = 0.405 (s)
SELECT CASE: n =300000000, ss = 0.1296420E+11, time = 0.402 (s)
IF-Goto: n =300000000, ss = 0.1296420E+11, time = 0.400 (s)
IF-noGoto: n =300000000, ss =-0.4442400E+10, time = 0.246 (s)
IF-ELSE: n =300000000, ss =-0.4442400E+10, time = 0.246 (s)
GOTO costs totally 0.809 (s)
SELECT CASE costs totally 0.804 (s)
IF-Goto costs totally 0.800 (s)
IF-noGoto costs totally 0.493 (s)
IF-ELSE costs totally 0.492 (s)
Total time: 3.398 (s)
so IF statements are significantly faster.