HACKER Q&A
📣 Decabytes

Anyone know why Free Pascal's startup is so fast?


I came across this benchmark https://github.com/bdrung/startup-time and I was absolutely blown away by how fast Free Pascal's startup is. Between that and the numbers FP put up in memory usage in https://thenewstack.io/which-programming-languages-use-the-least-electricity/ I'm curious to give the language a go


  👤 stncls Accepted Answer ✓
I would need further digging to be sure, but my guess would be this:

First, Free Pascal being an older language, it should have a relatively lightweight startup, by which I mean closer to C than Go (garbage collection) or C++ (exceptions? standard library constructors?), among compiled languages.

Now why is it so much faster than C? My bet is that it is because the Free Pascal Compiler performs static linking by default [1]. Therefore, no invokation of ld.so and no shared object lookup. Those all involve syscalls and filesystem interactions.

[1] https://wiki.freepascal.org/Lazarus/FPC_Libraries#:~:text=Ge....