Over the past several weeks I have implemented a program that processes a directory of .csv files. I coded it in Java 8, Fantom, and Kotlin. I tried to pretty much duplicate the code while taking advantage of any neat constructs I could find. I'm a pretty experienced Java programmer, so I think I did a credible job in that language.
To my surprise, the Fantom program was significantly faster.
To process around 100 files:
Java 8: 2.9 seconds. 141 lines Kotlin: 4.2 seconds. 130 lines Fantom: 1.2 seconds. 105 lines
While I haven't profiled the results carefully, it appears that Fantom's library is one of the things that's faster. Things like converting date strings to Date objects.
There is definitely some libraries that we've optimized the heck out of - especially the sys APIs. I'd be interested to know where the actual differences are too
I'll put the programs and data in GitHub at lel4866/FantomPerformance. Give me a day or so. Then you can look at it anytime you like.
Files have been uploaded to GitHub
Actually looks like you are using sys::Decimal (BigNumber) in Fantom, but others you are using java.lang.Double which would be sys::Float in Fantom. Switching to be Float might actually be even faster
Just to say I think it's cool that a language derived from Java, is faster than Java!
Well done Brian and Andy! And thanks Lawrence for writing the tests and bringing it our attention!
The huge performance different is actually caused by that Date.fromLocale in Fantom is much faster than LocalDate.parse in Java8.
From my findings, Fantom's sys API is faster in two ways:
If plug some code to warm up JIT before running the benchmark, I got the following results:
Fantom: 1016ms Kotlin: 1616ms Java8: 1917ms
Login or Signup to reply.