[fpc-pascal] fast text processing

Marco van de Voort marcov at stack.nl
Wed Oct 31 08:36:15 CET 2007


> I had never used Perl before. Until someone showed me Perl is very fast 
> for text processing (using its powerful regex), despite it's an 
> interpreted language. It even beat Delphi and FPC though both are 
> compiled language. A few lines Perl program almost two times faster than 
> a few pages pascal program.
> 
> How can an interpreted language is faster than a compiled language (I 
> assume both has been optimized well and using the best algorithm)? Can 
> FPC improve its text processing related classes/units, so they can be 
> faster than Perl (as it should be, logically)? Especially the TStrings 
> class.

Perl is about regex. They use regex even for stuff where regexes aren't necessary.
Since Perl is so fixated on regex, it is likely the case where most time is
spent. Moreover, regexes are relative tight statemachines, and most of the
time of regex benchmarks is spent in it, and thus outside perl.

TStrings is meant for GUI purposes. It's design and implementation are not
optimized.



More information about the fpc-pascal mailing list