* * *

Author Topic: FP vs Java Benchmark  (Read 5759 times)

JD

  • Hero Member
  • *****
  • Posts: 1564
Re: FP vs Java Benchmark
« Reply #30 on: December 06, 2016, 11:51:50 am »
Then again, if you compare Java's JavaFX (3d hardware accelerated GUI toolkit), it performs just as well as Qt5's hardware accelerated GUI.

Wrong forum I know. But does Java FX have a future? I love it but the initial euphoria seems to have died down and many Swing developers are still sitting on the fence not willing to adopt it. I've dragged my feet on it for a while now and I've been looking carefully at the rise of HTML5.

As for Qt, it isn't free so I had to look elsewhere.

After reading Thaddy's responses, I'm now very skeptical about Java on the server. Maybe FP on the server will be better & then open it up to several types of clients.

Great discussion by the way.  :D

JD
« Last Edit: December 06, 2016, 11:56:02 am by JD »
Windows (10, 7) - Lazarus 1.6.4/FPC 3.0.2 (also Delphi occasionally)
Linux Mint Cinnamon  - Lazarus 1.4/FPC 2.6.4
Indy 10.6 series; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5429
Re: FP vs Java Benchmark
« Reply #31 on: December 06, 2016, 12:30:11 pm »
Huh? With the security history of Java?
I always find that statement funny. Java is the post popular programming language to date (search the net for multiple confirmations of this). That also means it is used by the millions of technical people. A lot of eyeballs looking for problems, so yes problems will show up - like  any software out there. Oracle had a slow start with Java, but they are on the ball now, and fix issue rather fast (for such a large company). An while the bug fixes come out, they also keep pumping out new features in Java. It's actually pretty darn amazing if you ask me.

I'm sure if you through 20 million developers at FPC, Mantis will be bogged down with bugs and security issues for the next couple of years. FPC isn't even a drop in the bucket compared to Java.

That is certainly true.

But I don't get monthly updates for MSVCRT, MFC,MSDAC (static runtime for C/C++), but I do get them for Java and .NET. MSXML has been a regular update candidate though.

Somehow there seem to be more security updates for languages that are supposed to be safe, even when compared with equally or even more targeted languages like the native MS toolchains. So there seems to be something more going on than just popularity.

Maybe accessing the whole runtime from every app makes it more urgent?

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: FP vs Java Benchmark
« Reply #32 on: December 06, 2016, 05:34:45 pm »
Of course, but generally you would expect native code to out-perform a VM because a VM has an extra layer of abstraction. For the same reason you would expect assembly language to out-perform C.
Today's compilers (at least a few of the major ones) are pretty darn impressive with how they can produced performance ready code. As for your statement amount assembly language - that's highly dependent on the skills of the developer. If I had to try and write assembly now (haven't done so for a very long time), it will mist likely be crap. :)

Quote
https://benchmarksgame.alioth.debian.org/u64q/pascal.html
So because Java beats FP here on most algorithms, is it fair to conclude that Java is a "faster" language than FP? I don't think so.
But the proof is right there in the benchmark results, so how can you still have doubts? ;-)
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: FP vs Java Benchmark
« Reply #33 on: December 06, 2016, 05:40:14 pm »
Wrong forum I know. But does Java FX have a future? I love it but the initial euphoria seems to have died down and many Swing developers are still sitting on the fence not willing to adopt it.

I guess the problem is that JavaFX is more tightly integrated with the hardware, thus more work before it is supported on certain platforms. eg: There is Java support for FreeBSD, but no JavaFX. So, as impressive as JavaFX is, I turned it down because I can't develop with it on my development system [FreeBSD].  I'm also not a big fan of the "requires hardware acceleration to work" - that seriously limits where applications can run. This is not just a JavaFX issue, but Qt5 and all other similar frameworks too.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: FP vs Java Benchmark
« Reply #34 on: December 06, 2016, 05:44:52 pm »
But I don't get monthly updates for MSVCRT, MFC,MSDAC (static runtime for C/C++), but I do get them for Java and .NET. MSXML has been a regular update candidate though.
Microsoft has never been very forthcoming when it comes to bugs - not many large companies are. So that makes it all the more impressive for Oracle to be so open about Java. Oracle is working hard to make Java better, and it shows they are achieving that goal, otherwise Java wouldn't be the #1 language in the world.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

BBasile

  • Sr. Member
  • ****
  • Posts: 283
Re: FP vs Java Benchmark
« Reply #35 on: December 06, 2016, 05:48:15 pm »
I'm currently learning Java as well as FP & Lazarus and was curious about the performance of Java compared to FP so thought I'd compare the times to find 100,000 primes. Code for FP:

Code: Pascal  [Select]
  1.   for i := 1 to LIMIT do

Now the Java code (using version 1.8 of the JRE)
Code: Javascript  [Select]
  1.     for(int i = 1; i < limit; i++)


Open your eyes, the bigger, the wider you can !!
After a while you'll see something funny...

lainz

  • Hero Member
  • *****
  • Posts: 1861
  • Nace una flor, todos los días sale el sol...
    • BGRABitmap
Re: FP vs Java Benchmark
« Reply #36 on: December 06, 2016, 06:07:53 pm »
I'm currently learning Java as well as FP & Lazarus and was curious about the performance of Java compared to FP so thought I'd compare the times to find 100,000 primes. Code for FP:

Code: Pascal  [Select]
  1.   for i := 1 to LIMIT do

Now the Java code (using version 1.8 of the JRE)
Code: Javascript  [Select]
  1.     for(int i = 1; i < limit; i++)


Open your eyes, the bigger, the wider you can !!
After a while you'll see something funny...

say Limit is 5

the fpc code will do 1 to 5, the java code will do 1 to 4

BBasile

  • Sr. Member
  • ****
  • Posts: 283
Re: FP vs Java Benchmark
« Reply #37 on: December 06, 2016, 06:27:37 pm »
Yes, that was the thing to see. Honestly I don't know if it changes much to the benchmark but at least the results must be correct and identical for each language that's tested.

Personally I always avoid the for statements. In D for example you can use foreach over a range and with the optimizations the same code as for a for is generated.

Code: D  [Select]
  1. foreach(immutable i; lower..upper){}

The only thing to remember is that the upper bound is excluded, contrary to Pascal ranges.

igouy

  • New member
  • *
  • Posts: 24
Re: FP vs Java Benchmark
« Reply #38 on: December 06, 2016, 06:31:32 pm »
Quote
https://benchmarksgame.alioth.debian.org/u64q/pascal.html
So because Java beats FP here on most algorithms, is it fair to conclude that Java is a "faster" language than FP? I don't think so.
But the proof is right there in the benchmark results, so how can you still have doubts? ;-)

But "Measurement is not prophesy" and what does "a faster language than" even mean? ("Which *programs* are fast?") ;-)

http://benchmarksgame.alioth.debian.org/dont-jump-to-conclusions.html#not-prophesy

Leledumbo

  • Hero Member
  • *****
  • Posts: 7571
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: FP vs Java Benchmark
« Reply #39 on: December 07, 2016, 07:14:09 am »
Quote
https://benchmarksgame.alioth.debian.org/u64q/pascal.html
So because Java beats FP here on most algorithms, is it fair to conclude that Java is a "faster" language than FP? I don't think so.
But the proof is right there in the benchmark results, so how can you still have doubts? ;-)

But "Measurement is not prophesy" and what does "a faster language than" even mean? ("Which *programs* are fast?") ;-)

http://benchmarksgame.alioth.debian.org/dont-jump-to-conclusions.html#not-prophesy
Indeed, the benchmark game ain't no language comparison, but program comparison. Not all programs are written equal (i.e. one multithreaded the other not, see reverse-complement, fasta, spectral-norm and binary-trees, divide the number by 4 and you will see the difference is not that huge and actually Free Pascal still wins in some) and not all programs can be written equal (due to optimization style specific to each language). One can always submit a better one, but of course actual compiler optimizations will help, too. We're missing a lot of loop optimizations.

derek.john.evans

  • Guest
Re: FP vs Java Benchmark
« Reply #40 on: December 07, 2016, 07:29:01 am »
Did I miss the answer to my question, which was,

What was the optimization level for the FPC test?
And, was the test run without the debugger present?

At the end of the day, unless the Java JIT is producing better asm code than FPC's AOT asm code, then FPC should be faster.

It just seems to be an optimization question to me. Im also not up on the latest asm code, so, maybe Java JIT is using opp codes which are only available on modern PC's?

Were as FPC will run on my 10 year old clunker.

Leledumbo

  • Hero Member
  • *****
  • Posts: 7571
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: FP vs Java Benchmark
« Reply #41 on: December 07, 2016, 07:56:01 am »
At the end of the day, unless the Java JIT is producing better asm code than FPC's AOT asm code, then FPC should be faster.

It just seems to be an optimization question to me. Im also not up on the latest asm code, so, maybe Java JIT is using opp codes which are only available on modern PC's?

Were as FPC will run on my 10 year old clunker.
Just to answer you curiousity, Oracle Java JIT (we have to be very specific here) does take advantage of the underlying platform at runtime. If it detects a platform which supports certain fast, hardware specific instruction for the code it's about to execute, it will use the instruction.

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: FP vs Java Benchmark
« Reply #42 on: December 07, 2016, 10:48:09 am »
But "Measurement is not prophesy" and what does "a faster language than" even mean? ("Which *programs* are fast?") ;-)
Like I said, I have some Java desktop applications here that are very fast. I simply can't ignore that fact. I was always concerned about Java's memory usage, but got over that - memory is cheap and most entry level computers have 4-8GB of RAM. Hell, my mobile phone also has that amount of memory! Also what's the point of having RAM, but never gets used. Java uses as much as it needs. ;-)

Java has millions of developers, tons of fantastic frameworks, a massive ecosystem and better development tools. As much as I love Free Pascal, I can't deny that Java is very attractive and has a lot going for it.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: FP vs Java Benchmark
« Reply #43 on: December 07, 2016, 10:52:31 am »
Were as FPC will run on my 10 year old clunker.
But then Java also has something else, which FPC doesn't. Just the other day I wrote code that used 10 year old *.class files (I don't have the original *.java files any more). I really didn't expect it to work, but it did. Try and use 10 year old *.ppu and *.o files with FPC 3.0.0 - you can't!
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Jay

  • New member
  • *
  • Posts: 31
Re: FP vs Java Benchmark
« Reply #44 on: December 07, 2016, 01:53:02 pm »
Did I miss the answer to my question, which was,

What was the optimization level for the FPC test?
And, was the test run without the debugger present?

See reply #7  :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus