Hi

thank's  at all for your help!

Here some more Information:

1.) I think, that the inc(counter) procedure is faster then counter:=counter+1;.
     In the FreePascal book (Free Pascal; M. van Canneyt,F. Klämpfl; C&L; 2000; 
ISBN 3-932311-67-1; S. 519) you can find this information.

2.) I think, FreePascal produce fast programs. I look in fpc options an found:
                  -O<x>  optimizations:
                   -OG        generate faster code (default)
     I use this default option. I use on gcc no specific optimizations.

3.)The version is "Free Pascal Compiler version 2.0.4 [2006/08/22] for i386".

4.) n is not so high (i think on 32 or 64) but the program must work in 
Realtime mode.
     The library produce an periodic callback-process and I will know some 
informations (out1,out2) which are in two arrays (libout1,libout2);

     I know, programs with a writeln() have lower performance, but I think, 
printf() and writeln() must do the same. This need time to calculate.
     But the difference between printf() and writeln() are so, that the fpc 
program breaks with errors.

     Here the Informations about the difference:
      You can produce with gcc an output like the example source with 80% CPU 
efficiency.
      The fpc program with only the line "writeln(out1:0:4);" works without 
breaking by 100% CPU efficiency. "writeln(out1:0:5);" will break.

regards,
Markus

--------------
C source:

for (i=0;i<n;i++) {
  out1=(single) libout1[i];
  out2=(single) libout2[i];
  count+=1;
  printf("%20.0f%15.5f%15.5f\n",count,out1,out2);}

--------------
fpc source:

for i:=0 to n do
begin
  out1:=single(libout1[i]);
  out2:=single(libout2[i]);
  inc(count);
  writeln(stdout, count:20, out1:15:5, out2:15:5); (* This will break! *)
end;

--------------

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to