Check out Smess, our featured variant for February, 2025.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Tue, Aug 4, 2020 02:28 AM UTC in reply to Fergus Duniho from 02:13 AM:

The do while loop calls the same PHP function as function recursion does each time it iterates the loop, because it uses it to evaluate the expression after while. Plus, it has a bit more overhead for operating the looping mechanism. So, that may explain why it's slower.

I just added this code:

stopwatch reset;
foreach a fn range 0 10000:
next;
stopwatch;

And it got the fastest result:

Elapsed time: 0.039952039718628 seconds

It saved a lot of time by never trying to evaluate a as an expression.