[fpc-pascal] Why is Random(255) some 529x slower compared to Delphi 7?

John Lee johnelee0 at gmail.com
Wed Dec 7 14:38:36 CET 2011


Why not use the previous fpc version - I guess similar to that in delphi- I
can remember an email when Jonas changed it quite a few years ago  - Jonas
must have older version -  but can't really remember the fpc version -
v1.0? My guess it could be found in either svn or more likely the older cvs
fpc archive.

John

On 7 December 2011 13:10, Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:

> On 7 December 2011 14:54, Jonas Maebe  wrote:
> >
> > That's correct. We use the mersenne twister, Delphi probably a linear
> > congruential generator. The mersenne twister has a much larger period.
>
> OK thanks for the info. This is a serious performance hit, but I
> understand that the FPC implementation is different. Does FPC have a
> faster (comparable to Delphi) version of Random() too?
>
> @Michael,
> Should the FPC docs maybe mention the fact that the FPC version is
> considerably slower that Delphi (with an explanation why of course) -
> purely for the purpose of informing those porting code from Delphi to
> FPC. The original code in tiOPF is so slow, I almost thought the
> program froze - thus making that code really unusable in an
> application. Luckily that code will normally not be used in a real app
> though. Delphi developers wanting to move to FPC should really be
> warned about this, and use Random() sparingly.
>
> --
> Regards,
>   - Graeme -
>
>
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://fpgui.sourceforge.net
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111207/b4696411/attachment.html>


More information about the fpc-pascal mailing list