[fpc-pascal] When Pascal code is too fast

ik idokan at gmail.com
Wed Oct 31 23:45:28 CET 2007

Hi List,

I have a weird problem. the "fpWrite" is too "slow" for FPC code. When
I have the same exact code in C that writes a big amount of buffers of
the same size with the same content. It seems that the fpWrite is way
too fast, and the can't handle another call in the loop, and I need to
slow down the loop using usleep.
At the beginning I thought that it was a problem with fpWrite, so I
created my own binding, but still the problem is the same.

Except then the fact that it seems that FPC is much faster the GCC,
any other ideas for such a behavior and what might be the reasons for
it ?

A POC for such code btw, can be as follows:

while not EOF(f) do
      fpwrite(f2, S[0], length(S));

while (! feof(f)) {
  s_size = fread(f, s, MAX_BUFFER);
  write(f2, s, s_size);

This is a POC I wrote just here for the email, but the actual code
that I'm talking about is 100% equal with the content and the amount
of data that was read.


More information about the fpc-pascal mailing list