events:
1,450,000 iterations at 29 fps
python:
550,000 iterations at 29 fps
That's interesting, thanks for doing the measurement. Also, IIRC, Python doesn't evaluate the range(0,550000) statement every iteration in a for loop (otherwise it'd be even slower!), so a function call wouldn't even things up.
I can explain why the For condition shows up as so fast: the per-iteration overheads of the loop conditions in Construct are actually incredibly low - comparable to the overheads of a C++ loop. The real work comes in the overhead of executing actions, conditions and expressions (each of which involve a for-each and execution of function pointers which are comparatively expensive for C++), as well as the list processing of conditions which pick from a list of instances. None of that is present in the events in your test.
If it interests anybody, the For condition with no actions or subevents, in a release build, with a good branch-predicting CPU, effectively comes down to this:
__int64 r = ...;
// ...
for ( ; r != end; r += step) {
// (omitted some branches here which will be correctly guessed
// and have almost no performance impact)
pCRuntime->pCurrentEvent = pThisEvent;
}[/code:vc2hdvg8]
As you can see it's simply a for loop with a 64 bit index that assigns a pointer every iteration. This kind of thing takes literally a handful of cycles out of your 3 billion or whatever a second. I'm kinda proud I got the overhead that low and it runs so fast
Adding an Always condition essentially adds a function call or two, and a call through a function pointer, which explains the reduction in performance.
Making a fair test is tricky especially considering your framerate will largely depend on the rendering too. I propose maybe doing some kind of processing on a bunch of say 1000 sprites, and write equivalents in Python and events and see which goes faster.