[fpc-pascal] for .. in loop implementation

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jan 8 19:34:40 CET 2009


On 08 Jan 2009, at 19:01, J├╝rgen Hestermann wrote:

> I doubt that. I often stumble over programs which are awfully slow  
> (Novell Salvage Dialog for examples sometines needs many minutes to  
> sort 80 "objects"!). And that compared with the everywhere heard  
> statement "You don't need to think about performance, it's only  
> important that it runs at all" makes me thinking. Many programmers  
> simply don't know about how their mighty language functions perform  
> and what they do in the background. But without knowing this you  
> don't even have an idea of how fast it will be.
>
> I also had such experience with Virtual Pascal where the FindFirst/ 
> FindNext API functions are obscured by an extra layer to support  
> multiple platforms (which I didn't know at first). I only wondered  
> why my simple scan program for the creation date of files took 2  
> days on our server. After removing all the overhead by directly  
> using FindFirst/FindNext from the windows API it boosted up to 6  
> hours only. Sure, many people don't care whether a program runs 2  
> days or 6 hours but I do.

These are examples of bad underlying implementations. In both of these  
cases the implementation can probably be optimised to deliver close to  
maximal performance. The evolution to more and more abstraction is  
simply because there are more and more different underlying platforms,  
and because the days that most programmers were able to take full  
advantage of the underlying platform are long gone. With the moves to  
system and process virtual machines, many-cores, cloud computing,  
accelerators etc. this is only getting worse.

Not to mention that going as low level as possible to get the last bit  
of performance will mean that you'll have to redo that work over and  
over again, unless you stay with one particular generation of one  
particular platform.


Jonas


More information about the fpc-pascal mailing list