On Saturday 11 June 2005 00:02, Joost van der Sluis wrote: > > > I don't know if rtl-optimilisation patches have a large priority, but > > > nevertheless this patch improves the speed of the sysutils.uppercase > > > and lowercase functions. > > > > I fail to see how changing a while loop to a for loop improves speed ? > > I could understand if you'd use a PChar and use pointer math, but not > > this ? > > I wasn't completely sure, so i made a test-prog which called the function > 50.000 times, and measured the time it took to run a few times. > > And then again with the other version. (approx 2.5 sec against 1.4) > > And I think it's because the removal of the begin/end. And Peter always > says that you can't change the running variable in a for-loop because of > the optimilisations... So i suppose that a for-loop has several > optimilisations which a while doesn't...
While this is _potentially_ true of a for-loop, don't expect it to hold in every situation. (and trust me, it's _certainly_ not because of the begin-end removal) -- Regards, Christian Iversen _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
