Re: [fpc-pascal] fast text processing

2007-10-30 Thread Vincent Snijders
Bee schreef: TStrings is meant for GUI purposes. It's design and implementation are not optimized. Then its our task to optimize it more (and more) so it could as fast as Perl. What I meant here is using standard or default FPC's classes/units. ;) I don't count any third parties class/units/l

Re: [fpc-pascal] fast text processing

2007-10-30 Thread Bee
TStrings is meant for GUI purposes. It's design and implementation are not optimized. Then its our task to optimize it more (and more) so it could as fast as Perl. What I meant here is using standard or default FPC's classes/units. ;) I don't count any third parties class/units/library or non

Re: [fpc-pascal] fast text processing

2007-10-30 Thread Bee
Or even better, give a clear problem description. TASKS: First, is to count number of words inside the document. Second, is to count number of unique words inside the document. INPUT: Document format is using HTML-like format for storing articles. Here's the format: (contains an article)

Re: [fpc-pascal] fast text processing

2007-10-30 Thread Marco van de Voort
> 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 page

Re: [fpc-pascal] Re: Why this evaluates on "if" wrong ? (GMP)

2007-10-30 Thread Vinzent Hoefler
On Tuesday 30 October 2007 17:31, Inga Petuhhov wrote: > A copy-paste from Python Shell: > >>> a = 1 > >>> a > > 1 > > >>> a = a + 0.4 > >>> a > > 1.3999 > > >>> a = a - 0.4 > >>> a > > 0.99989 > > >>> a == 1 > > False Or a bit more simple (and for some maybe even more surp

Re: [fpc-pascal] fast text processing

2007-10-30 Thread Vincent Snijders
Bee schreef: The pascal counter-part resulting almost twice slower. Though not as simple as Perl, the pascal code is quite simple and only using standar fpc's units. But, I won't post the code here to not influence your logic. ;) For me it would be better if you posted the pascal program, bec

Re: [fpc-pascal] fast text processing

2007-10-30 Thread Bee
Give us a test case (some example source code) and I will beat the living crap out of any perl script. Perl is built using Cee, so anything Perl can do Cee can do better.. which means Pascal can do better or similar. Perl is not written in Perl. In other words, perl is just a wrapper around the Ce

Re: [fpc-pascal] fast text processing

2007-10-30 Thread L
> Hi all, > > 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

[fpc-pascal] fast text processing

2007-10-30 Thread Bee
Hi all, 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 page

Re: [fpc-pascal] Speed

2007-10-30 Thread L
> If the code is more efficient with a "goto", this is sufficient to > justify its use. Or if the code is clearer, for example to avoid deep nesting... Or to make clean errors and debugging log files easier: exit; .// default //else error1: begin debugln('error1'); exit; end; error2 begin

Re: [fpc-pascal] Speed

2007-10-30 Thread mm
L a écrit : P.S. Where i can read tips about writing fast FP code? Also see some of the fastcode projects: http://www.fastcode.dk/fastcodeproject/fastcodeproject/index.htm And I'm sure you know you can always use GOTO statements when you really need speed out of loops :) As a matter of fa

Re: [fpc-pascal] Speed

2007-10-30 Thread mm
bartek a écrit : On Tuesday 30 October 2007 22:07:21 Valdas Jankūnas wrote: P.S. Where i can read tips about writing fast FP code? FP is no Java. You get what you write. If you don't use virtual functions in OO-code, there are no hidden performance killers. First identify the bottleneck in yo

Re: [fpc-pascal] Speed

2007-10-30 Thread L
> I hear the Intel C compilers and Fortran compilers and Ada compilers are better > optimized for certain things since FPC/delphi are generally desinged for GUI > programming. ;-) >> >> C/Fortran yes, Ada no; there exists no Intel Ada compiler. It is also >> false that FPC is slow because it has be

Re: [fpc-pascal] Speed

2007-10-30 Thread Daniël Mantione
Op Tue, 30 Oct 2007, schreef L: > > I think first code is faster than second, because in first code > > SubCalculate function is in calling function body? > > Actually some times local scope functions are slower because the variables > need > to be carried around since you are doing somewhat

Re: [fpc-pascal] Speed

2007-10-30 Thread L
> > P.S. Where i can read tips about writing fast FP code? Also see some of the fastcode projects: http://www.fastcode.dk/fastcodeproject/fastcodeproject/index.htm And I'm sure you know you can always use GOTO statements when you really need speed out of loops :) (not always, only if absolut

Re: [fpc-pascal] Speed

2007-10-30 Thread L
> I think first code is faster than second, because in first code > SubCalculate function is in calling function body? Actually some times local scope functions are slower because the variables need to be carried around since you are doing somewhat of a lexical closure. The local scope function

Re: [fpc-pascal] Speed

2007-10-30 Thread bartek
On Tuesday 30 October 2007 22:07:21 Valdas Jankūnas wrote: > L rašė: > > Here's one: profile your code! > > And where can you read how to do that? > > > > VALGRIND > > I processed my app trough "valgrind -v --tool=callgrind ./my_app", > opened generated report with Kcachegrid and vi

Re: [fpc-pascal] Installing FPC on CentOS 5 x64

2007-10-30 Thread Marco van de Voort
> This package installs fine but fp IDE doesn't work. It still requires > libtinfo.so.5 :( . Some students of my university likes Turbo Pascal > then, I thinks that fp IDE would not scare them... There was some similar bugreport from a SUSE user. We devised a fix, and he afaik managed to build SUS

Re: [fpc-pascal] Speed

2007-10-30 Thread Valdas Jankūnas
L rašė: Here's one: profile your code! And where can you read how to do that? VALGRIND I processed my app trough "valgrind -v --tool=callgrind ./my_app", opened generated report with Kcachegrid and viewed how many times called some procedures and etc. Sorry for stupid question: i have n

Re: [fpc-pascal] Speed

2007-10-30 Thread L
Here's one: profile your code! >>> And where can you read how to do that? VALGRIND ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Speed

2007-10-30 Thread Valdas Jankūnas
Mattias Gärtner rašė: Zitat von Krishna <[EMAIL PROTECTED]>: On 10/30/07, Mattias Gärtner <[EMAIL PROTECTED]> wrote: Zitat von Krishna <[EMAIL PROTECTED]>: On 10/30/07, Valdas JankÅ«nas <[EMAIL PROTECTED]> wrote: P.S. Where i can read tips about writing fast FP code? Here's one: profile

[fpc-pascal] Re: [MacPascal] FPC and Mac OS X 10.5

2007-10-30 Thread Jonas Maebe
On 26 Oct 2007, at 16:58, Jonas Maebe wrote: I will merge the fixes for the last two issues to FPC 2.2.1 some time during the coming days and put up snapshot installers with that version for PPC and i386 on the ftp site. They are now uploaded and available at respectively (mind the line wra

Re: [fpc-pascal] Installing FPC on CentOS 5 x64

2007-10-30 Thread Paulo Estrela
Hi Coco, This package installs fine but fp IDE doesn't work. It still requires libtinfo.so.5 :( . Some students of my university likes Turbo Pascal then, I thinks that fp IDE would not scare them... 2007/10/28, Coco Pascal <[EMAIL PROTECTED]>: > Paulo Estrela schreef: > > Hi, > > > > I was trying

Re: [fpc-pascal] Re: Why this evaluates on "if" wrong ? (GMP)

2007-10-30 Thread Inga Petuhhov
A copy-paste from Python Shell: a = 1 a 1 a = a + 0.4 a 1.3999 a = a - 0.4 a 0.99989 a == 1 False Best regards Inga PS I always talk to my informatics-students: You never-ever do with real-variables something like this: if real1 = real2 then ... Real numbers c

Re: [fpc-pascal] Speed

2007-10-30 Thread Mattias Gärtner
Zitat von Krishna <[EMAIL PROTECTED]>: > On 10/30/07, Mattias Gärtner <[EMAIL PROTECTED]> wrote: > > Zitat von Krishna <[EMAIL PROTECTED]>: > > > > > On 10/30/07, Valdas Jankūnas <[EMAIL PROTECTED]> wrote: > > > > > > > P.S. Where i can read tips about writing fast FP code? > > > > > > > > > > H

Re: [fpc-pascal] Speed

2007-10-30 Thread Krishna
On 10/30/07, Mattias Gärtner <[EMAIL PROTECTED]> wrote: > Zitat von Krishna <[EMAIL PROTECTED]>: > > > On 10/30/07, Valdas Jankūnas <[EMAIL PROTECTED]> wrote: > > > > > P.S. Where i can read tips about writing fast FP code? > > > > > > > Here's one: profile your code! > > And where can you read how

Re: [fpc-pascal] Speed

2007-10-30 Thread Mattias Gärtner
Zitat von Krishna <[EMAIL PROTECTED]>: > On 10/30/07, Valdas Jankūnas <[EMAIL PROTECTED]> wrote: > > > P.S. Where i can read tips about writing fast FP code? > > > > Here's one: profile your code! And where can you read how to do that? Mattias ___ fp

Re: [fpc-pascal] Speed

2007-10-30 Thread Krishna
On 10/30/07, Valdas Jankūnas <[EMAIL PROTECTED]> wrote: > P.S. Where i can read tips about writing fast FP code? > Here's one: profile your code! Cheers, -Krishna -- One reason that life is complex is that it has a real part and an imaginary part -Andrew Koenig ___

[fpc-pascal] Speed

2007-10-30 Thread Valdas Jankūnas
Now i write program, that program made extensive calculations. And i want write fast code. Question about executing speed: first code- function Calculate1: Extended; function SubCalculate: Extended; begin ... end; begin ... ..:=SubCalculate; ... end; second code- function

Re: [fpc-pascal] Re: Why this evaluates on "if" wrong ? (GMP)

2007-10-30 Thread Andrea Mauri
But someone tried to reproduce the example with other programming languages? mm ha scritto: Tom Verhoeff a écrit : In fact, the GMP (GNU Multiple Precision Arithmetic Library ) offers this and more. Unfortunately, there does not seem to be a complete FreePascal interface for it. Maybe it

Re: [fpc-pascal] Re: Why this evaluates on "if" wrong ?

2007-10-30 Thread mm
Germán Pablo Gentile - PetroBox a écrit : El mar, 30-10-2007 a las 02:28 +0100, mm escribió: Joao Morais a écrit : Daniël Mantione wrote: And, as said before, no datastructure is adequate for storing a mathematical real number. Not even if you have infinite memory. Nope. If infinite memory was

Re: [fpc-pascal] Re: Why this evaluates on "if" wrong ?

2007-10-30 Thread Germán Pablo Gentile - PetroBox
El mar, 30-10-2007 a las 02:28 +0100, mm escribió: > Joao Morais a écrit : > > Daniël Mantione wrote: > >> And, as said before, no datastructure is adequate for storing a > >> mathematical real number. Not even if you have infinite memory. > > > > Nope. If infinite memory was tangible, you would