Recent

Author Topic: Benchmarks fpc vs gcc.  (Read 758 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 2905
    • StrumPract is the musicians best friend
Benchmarks fpc vs gcc.
« on: October 29, 2022, 02:24:05 pm »
Hello.

Somebody sent me this link:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/fpascal-gpp.html

What do you think?
Pertinent?

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10492
  • FPC developer.
Re: Benchmarks fpc vs gcc.
« Reply #1 on: October 29, 2022, 02:40:07 pm »
Why don't you search for the benchmarks game here on the forum? IIRC the maintainer (IGouy) is/was even member of the forum.

My short opinions: short one file benchmarks are one sided. Also the format of the benchmark games is so that.

About the memory and startup differences see e.g. https://stackoverflow.com/questions/11225580/does-freepascal-really-use-far-less-memory-than-gcc/11251397#11251397 . Some of the benchmarking is just a matter of different (RTL/linking preferences) defaults.

Fred vS

  • Hero Member
  • *****
  • Posts: 2905
    • StrumPract is the musicians best friend
Re: Benchmarks fpc vs gcc.
« Reply #2 on: October 29, 2022, 03:29:47 pm »
Why don't you search for the benchmarks game here on the forum? IIRC the maintainer (IGouy) is/was even member of the forum.

My short opinions: short one file benchmarks are one sided. Also the format of the benchmark games is so that.

About the memory and startup differences see e.g. https://stackoverflow.com/questions/11225580/does-freepascal-really-use-far-less-memory-than-gcc/11251397#11251397 . Some of the benchmarking is just a matter of different (RTL/linking preferences) defaults.

Perfect.
( And it seems that, once again, when libc is not used, all goes faster/better, .. okay, okay, I'm leaving )

Thanks Marcov.  ;)
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

abouchez

  • Jr. Member
  • **
  • Posts: 78
    • Synopse
Re: Benchmarks fpc vs gcc.
« Reply #3 on: November 28, 2022, 12:04:54 pm »
What is not obvious in this well-known "benchmark game" is that coders are allowed to use low-level tricks to make the code as fast as possible.
It was meant to display the fastest possible way of each language/framework.
Some experts of each language are indeed involved into tuning the code.
As a result, some of the code is highly optimized, but also really complicated/unreadable.
To be realistic and fair, no one write such code for a regular project, unless it is part of a library or a very sensitive core business (like finance or a game).

IMHO this "benchmark game" does not compare languages for their day-to-day usage.
I would never draw any conclusion from this "benchmark game" to pickup one language over another.
C almost always win. If you need something really fast, rewrite the sensitive part in C, then call it from your own language.

To compare solutions, I prefer something more simple, and more realistic, which tries to use the built-in language features.
The simple challenge we discussed about at https://forum.lazarus.freepascal.org/index.php/topic,61035.0.html is more likely to be useful for discussion.
It compares languages and libraries about a simple but realistic use case: returning some JSON from CSV data read into memory, in a REST/HTTP server.

It has no C/C++ version yet, because it targeted high-level "modern" languages.
My guess is that with some modern C/C++ libraries, you may reach very high performance.

We added two pascal versions to the challenge.
Some thought about it at https://blog.synopse.info/?post/2022/11/26/Modern-Pascal-is-Still-in-the-Race
In short: if someone says pascal is old/deprecated/slow, then it is clearly not.
You can write expressive and efficient code with pascal, with no highly complicated/unreadable code.
For this use case, the pascal server produces more than 900MB/s of results, so much more than any network interface is able to serve today. ;)

Feel free to redirect my blog link to the "somebody" who sent you the benchmark games link.
« Last Edit: November 28, 2022, 12:12:13 pm by abouchez »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8530
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Benchmarks fpc vs gcc.
« Reply #4 on: November 29, 2022, 05:15:35 am »
Well it's not hard to see the page nowadays shows all submissions instead of just the best, and more often than not, g++ is both the best and worst, showing who coded it matters more than what language / compiler the solution is coded in.

 

TinyPortal © 2005-2018