Recent

Author Topic: Why is process startup performance for Pascal programs using FCP so good?  (Read 1228 times)

padresmurfa

  • Newbie
  • Posts: 3
It's been almost 30 years since I last touched Pascal, and I admin, I had entirely dismissed the language as a viable tool from my tool-chest.

But today, I stumbled upon this analysis of startup times for various programming languages: https://github.com/bdrung/startup-time

Lo and behold, for this metric, FCP outperforms everything it was pitted against, being 3.5x as fast as the next runner-up, C, 5x-6x as fast as the cool kids on the block, Go and Rust, and 9x as fast as Bash, which should be a reasonable base-line for process startup times (seeing that it's sole purpose is to glue other processes together). FCP outperforms Python by an absurd 100x, and Java by perhaps 700x.

While I haven't run these benchmarks myself, I am assuming that they are likely in the correct ballpark, unless there was a serious flaw in the experiment. For example if FCP crashed quickly during startup, this went unnoticed, and the crash time was reported as a success time.

This kind of performance is hardly an accident. So I'm really curious to know, what's the secret sauce that makes FCP outperform the rest of the flock?


jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Why is process startup performance for Pascal programs using FCP so good?
« Reply #1 on: November 29, 2020, 11:24:17 am »
Thanks for sharing this. While it isn't new information that languages like Java or PHP are slow it is interesting to see precise numbers. The results confirm the usability of Pascal for number crunching. They also suggest that FPC would be an excellent language for domains like data science and computational statistics (given that suitable libraries are available).
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Why is process startup performance for Pascal programs using FCP so good?
« Reply #2 on: November 29, 2020, 11:36:16 am »
First of it's called FPC for Free Pascal Compiler, not FCP.

Second the example might be a bit skewed, because of how FPC compiles on Linux: a simple program like that Hello World program on that repository does not need any libraries thus the program will be linked completely statically depending on no other libraries thus the dynamic loader of Linux does not need to do anything. C programs on the other hand are dynamically linked by default. As soon as your program uses an external library or threads that changes and this will likely influence the startup time. Though it might still be that FPC programs come out far in front, definitely far in front of languages like Python or Java though.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Why is process startup performance for Pascal programs using FCP so good?
« Reply #3 on: November 29, 2020, 12:08:23 pm »
See also this thread on stack overflow.

Which is for the analogous case of memory usage, but might have related reasons.

The question is already questionable, simply because near all other languages are based on gcc/glibc. That just means one that doesn't automatically stands out.

« Last Edit: November 29, 2020, 02:13:14 pm by marcov »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Why is process startup performance for Pascal programs using FCP so good?
« Reply #4 on: November 29, 2020, 01:52:56 pm »
Thanks for clarifying this. What we need is more systematic comparative research.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

padresmurfa

  • Newbie
  • Posts: 3
Re: Why is process startup performance for Pascal programs using FCP so good?
« Reply #5 on: November 29, 2020, 05:17:14 pm »
First of it's called FPC for Free Pascal Compiler, not FCP.

Whoah, bad typo on my part! Sorry about that!

padresmurfa

  • Newbie
  • Posts: 3
Re: Why is process startup performance for Pascal programs using FCP so good?
« Reply #6 on: November 29, 2020, 05:21:34 pm »
See also this thread on stack overflow.

Which is for the analogous case of memory usage, but might have related reasons.

The question is already questionable, simply because near all other languages are based on gcc/glibc. That just means one that doesn't automatically stands out.

Thanks, marcov and PascalDragon. The perspective regarding dynamic linking, threading, glibc, and that stack overflow discussion in particular was very enlightening.


 

 

TinyPortal © 2005-2018