Recent

Author Topic: Free Pascal compiler no longer the best optimized open source compiler  (Read 28083 times)

JD

  • Hero Member
  • *****
  • Posts: 1755
Hi everyone,

I just read this article on Beeography  "Which Programming Language is the best?" and according to him, the FPC compiler is no longer the best optimized open source compiler.

http://beeography.wordpress.com/2011/05/04/which-programming-language-is-best/#more-483

In the study, it was even demonstrated that the FPC compiler is slower than the Java 6 server!  :o How can that be possible?

Does anyone have a contrary opinion and/or articles that proves that this is not actually the case?

JD
« Last Edit: September 10, 2011, 03:49:52 pm by JD »
Windows (10, 7) - Lazarus 2.0RC3/FPC 3.2, NewPascal, Delphi

Indy 10.6 series; mORMot; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

Leledumbo

  • Hero Member
  • *****
  • Posts: 8075
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #1 on: September 10, 2011, 11:04:53 am »
Quote
In the study, it was even demonstrated that the FPC compiler is slower than the Java 6 server!   How can that be possible?
Actually, the benchmark game has a number of parameters which if you set to some certain values, could make a language down or up drastically as well as others. It's not a reliable source. If there's also FPC server entry, that would be fairer.
Quote
Does anyone have a contrary opinion and/or articles that proves that this is not actually the case?
Why don't you try yourself? ;)
* hope you have enough time (and your computer has enough resources) waiting for Java programs to complete.

From scientific point of view, (bytecode) interpreted programs would NEVER exceed the speed of compiled programs, if the optimizations applied are about the same weight, even when JIT-ed. Because JIT-ing takes (a long) time + JIT result is usually not flushed into disk but retained in memory for fast access, but OS may swap the pages any time, causing a lot of page faults and slows the program down, a lot.
« Last Edit: September 10, 2011, 09:20:33 pm by Leledumbo »

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #2 on: September 10, 2011, 12:08:15 pm »
AFAIK, benchmark game does not compare exactly the same programs written in different languages. The programs may be very different (based on different algorithms or using differently multi-threading).
Lazarus 2.1.0 r59757M FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.2, Plasma 5.14.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7230
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #3 on: September 10, 2011, 01:00:14 pm »
In the study, it was even demonstrated that the FPC compiler is slower than the Java 6 server!  :o How can that be possible?

1) Choice of benchmarks,
2) allowing to tweak the runtime in a way an user usually doesn't
3) the fact that the FPC community mostly got fed up with the shootout and stopped updating the benchmarks.


Quote
Does anyone have a contrary opinion and/or articles that proves that this is not actuallt the case?

Basically I think only the magnitude matters. (<10, 10-50 >50), the rest is basically noise.


TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #4 on: September 12, 2011, 11:44:44 pm »
This brings two popular idioms to my mind: 1) Benchmarking apples against oranges, and 2) bytecode has snowball's chance in hell to outperform native code ;)
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #5 on: September 13, 2011, 12:43:05 am »
This brings two popular idioms to my mind: 1) Benchmarking apples against oranges, and 2) bytecode has snowball's chance in hell to outperform native code ;)

Instead of comparing apples and oranges, an even better analogy is comparing apples with apple trees.

OPascal is a language you create a "Java language" with.  I have several articles bookmarked about that very subject "creating compilers with delphi".  This series of articles has you building COMPILERS exactly like the "Java compiler"  they are benching against,using Delphi!

So how in the world are they even in the same category?

Would you use you "Java compiler" to construct a new, custom compiler?

No, you would use the language for building compilers. Assembly,Opascal, or C.

The beauty of using OPascal is you get true object oriented code at the deepest genetic level possible. You have all the benefits of OP for low level tasks (like compilers) as you do for gui apps. And remember this, we ASSUME that the OP model comes with overhead, hence slower, than say, Assembly or C. This is actually not so much the case at all because the object model was incorporated into the compiler itself. So OPascal is like an "Assembly driver" almost it seems and very closely coupled with the underlying Assembly itself vs. your Java compiler which could have been WRITTEN in Opascal.

So basically OPascal stands alone in many ways...Still...and always has since TurboPascal days

Leledumbo

  • Hero Member
  • *****
  • Posts: 8075
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #6 on: September 13, 2011, 01:17:44 am »
Quote
Would you use you "Java compiler" to construct a new, custom compiler?
Unfortunately, this is the case in many compiler classes, even they use JLex and JavaCUP for scanner and parser construction. Yucks!
Quote
And remember this, we ASSUME that the OP model comes with overhead, hence slower, than say, Assembly or C
A little slower execution, but a much faster development (say, 3-20 times), and much shorter code.

braximo

  • Jr. Member
  • **
  • Posts: 79
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #7 on: September 13, 2011, 04:59:41 am »
Oh well, as Bee has stated on the replies part, the test was on 2.4.0. But then when they re-tested it using 2.4.2, it was NO 1 once again!
Ubuntu 16.04 Lazarus 1.6

avra

  • Hero Member
  • *****
  • Posts: 1569
    • Additional info
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #8 on: September 13, 2011, 09:29:18 am »
But then when they re-tested it using 2.4.2, it was NO 1 once again!
Is there some link to confirm this?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Zoran

  • Hero Member
  • *****
  • Posts: 1421
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #9 on: September 13, 2011, 12:54:31 pm »
But then when they re-tested it using 2.4.2, it was NO 1 once again!
Is there some link to confirm this?

When you follow the link from the first post, then click on the grid showing the languages order, you get to this page:

http://shootout.alioth.debian.org/u32q/which-language-is-best.php?calc=chart&gcc=on&gpp=on&fpascal=on&java=on&csharp=on&xfullcpu=1&xmem=1&xloc=0&nbody=1&fannkuchredux=1&meteor=1&fasta=1&spectralnorm=1&revcomp=1&mandelbrot=1&knucleotide=1&regexdna=0&pidigits=1&chameneosredux=1&threadring=1&binarytrees=1

It seems that no one here read the comments from the page which is linked in first post. ;)

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #10 on: September 13, 2011, 01:10:39 pm »
@Zoran: Thanks, you made me pleased.
Some time ago I looked to these benchmarks and I noticed that C++ is faster but consumes much more memory (2-3 times in many cases). Compilation speed of Pascal compilers is usually very good. This link compares all.
Lazarus 2.1.0 r59757M FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.2, Plasma 5.14.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #11 on: September 13, 2011, 01:43:11 pm »
I just read the link in the fist post and to me one thing is quite obvious... it is FreePascal that all the others are attempting to match.

It is Freepascal that is on top. You can tell by the methods they use to try to knock it down.

FreePascal is "genetically" superior. It has advantages deep at the core level that not even C can boast. Only thing C can boast is in the speed department. Even that is misleading because you can easily optimize your FreePascal code for speed. These tests do not reflect performance based upon OPTIMIZED FreePascal code.

FreePascal has OO built into the compiler itself. all the other players are trying to emulate OO after the fact. TurboPascal took an approach waaaayyy back long ago that set it in a class on it's own. When everybody kept the "linear model" TurboPascal went full blast into OO with it's compiler, down at the genetic level. To be able to compete at this level, to even be on the playing field, would require that even C needs to go "back to the drawing board".

... FROM SCRATCH

All these "compiler shootouts" are moot because no other language took the OO route into their compiler.


lainz

  • Guest
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #12 on: September 13, 2011, 07:08:40 pm »
I like Lazarus FPC, with Qt takes a lot of time to compile a Hello World application.

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #13 on: September 13, 2011, 07:28:50 pm »
Study the test closer and the truth according to the numbers is that FPC is a good 20% FASTER than C!

Oops!
Edit:
20% size reduction

« Last Edit: September 13, 2011, 08:32:07 pm by CaptBill »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8075
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Free Pascal compiler no longer the best optimized open source compiler
« Reply #14 on: September 14, 2011, 01:54:03 am »
@Zoran:
As most people are lazy, they just click and accept what's presented by default in that page. The benchmark only compares speed by default, ignoring memory and code size. That's why C/C++ wins. When you add the other two, bye2 C/C++...

AFAIU, if you tick all 3 measurements, it means that the top language implementations have the best balance of the 3.