OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Java port of fft_bench.c

Wed Oct 02, 2013 11:15 am

In the on going flame war... I mean vibrant discussion here: http://www.raspberrypi.org/phpBB3/viewt ... 66&t=57012

There is benchmark called "fft_bench.c" attached to a post http://www.raspberrypi.org/phpBB3/downl ... hp?id=4734. Would someone with Java experience be so kind as to provide a port using the Oracle hard-float JVM and post the results?

User avatar
scruss
Posts: 3256
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Java port of fft_bench.c

Wed Oct 02, 2013 11:49 am

It's not a particularly good benchmark, though. It runs for a very short amount of time, and is hit by all sorts of timer errors.

For the float-heavy stuff I work with, I'm seeing a roughly 10× speedup using Oracle (pronounced: Sun) Java. Haven't quite cracked open Processing again, but it might be close to usable now.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5551
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Java port of fft_bench.c

Wed Oct 02, 2013 12:06 pm

scruss wrote:It's not a particularly good benchmark, though. It runs for a very short amount of time, and is hit by all sorts of timer errors.
The benchmark seems reasonable. gettimeofday has microsecond resolution, and I'm sure the test takes many microseconds.
If you are worried about a context switch throwing off the results, then run it ten times and discard the larger values.
It would be trivial to put the work into a loop and run it 1000 times if you'd prefer (and that may be more useful if you'd like the test to measure processing rather than uncached memory accesses).

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Java port of fft_bench.c

Wed Oct 02, 2013 3:33 pm

Ported. See topic in first post for results.

RoyLongbottom
Posts: 338
Joined: Fri Apr 12, 2013 9:27 am
Location: Essex, UK
Contact: Website

Re: Java port of fft_bench.c

Thu Oct 03, 2013 9:37 am

Following provides some Java comparisons for one of my benchmarks including JamVM and Oracle hard float via JRE 8.

http://www.roylongbottom.org.uk/Raspber ... m#anchor15

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Java port of fft_bench.c

Sun Mar 27, 2016 11:36 am

Sorry to dig up an old thread but somehow I missed it at the time....

@scruss,
It's not a particularly good benchmark...
Wait a minute, that's my pride and joy you are talking about!

But, yes you are right. It was not originally intended as a benchmark. The original code had two purposes:

1) I wanted to learn enough about the Fast Fourier Transform that I could write one of my own, from scratch. Even if the end result was not the worlds most optimized FFT. Mission accomplished.

2) I wanted to write an FFT for the Parallax Inc. Propeller micro-controller. To get any speed it would have to be written in assembler. The Propeller has no floating point hardware so it had to use 32 bit integers and fixed point arithmetic. That C code was the "pseudo code" for the assembler version. Mission accomplished.

After that in became a benchmark in a rather unusual sense. You see there were three C compilers for the Propeller so it could be used to compare them in some way. Then versions of that code were written in Spin, a high level language for the Propeller, and other languages. Provided the alternative language implementations closely followed steps and operations of the C version it became a way of comparing languages. At that point it is no longer about being an FFT but rather just a blob of code that does typical operations any program on an MCU might do.

As such I'd be very interested to see the Java version of fft_bench. I could add it to the collection.

@OtherCrashOverride
Ported. See topic in first post for results.
Thanks for posting the Java and C# versions. I have added them to the github repo: https://github.com/ZiCog/fftbench
Memory in C++ is a leaky abstraction .

Return to “Java”