On 13/06/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi
I wrote two programs one in C and one in Freepascal.
The program read a variable of a library and write it to stdout. I will put it into a file:
("#: ./dataprog > file.dat").
I use "printf" in the C and "writeln" in Freepascal.
The problem: The fpc-based program is explicit slower than the c-based program.
My questions: Why is it so? Is it possible to avoid the problem?
--------------
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);
end;
--------------
interesting... which version of fpc are you using? how big does n
go? you can use the time util to give us some figures.
henry
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal