Interesting! Try compiling using xlclang++ instead of xlc and see how you go. xlclang++ has a far superior standard library.

Nothing matches the speed of C :)

mckoss-c830;14259;5.0;1;algorithm=wheel,faithful=yes,bits=1

On 25/06/2021 10:22 am, Andrew Rowley wrote:
Dave Plummer has a series of Software Drag Racing videos, using a program to search for prime numbers as a simple speed test for different languages and/or hardware. The "drag race" description acknowledges that it isn't a comprehensive benchmark, just a test of speed at one particular simple task.

I thought it would be fun to try it on z/OS. I modified the C++ version to compile on z/OS, and there was a Java version that ran without modification.

Results were interesting.

- Java was much faster than C++ on z/OS. I modified the C++ version to change the vector<bool> to a byte/bit array (as was used in his first version) and performance was much better. However it still only matched Java, it didn't beat it. On other platforms C++ was much faster than Java e.g. 15-50%, maybe more.
- 31 bit code was about 10% faster than 64 bit, for both C++ and Java.

I configured my zIIP offline to make sure the Java code was running on a regular CP.

I'm interested to know why C++ didn't outperform Java. C++ isn't my language, so I might be missing something obvious. Any ideas?

Software Drag Racing video:
https://www.youtube.com/watch?v=l1j-aF_wyzU

C++ to run on z/OS:
https://github.com/andrew890/Primes/tree/drag-race/PrimeCPPzOS/solution_1

Java version:
https://github.com/andrew890/Primes/tree/drag-race/PrimeJava/solution_1


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to