Silly battle… in years past I’ve hand rolled assembler for bits of hot code
paths in C apps after profiling to see if it was necessary…


—- Kirk

On Sun, Jun 26, 2022 at 00:15 Roger Bergerin <[email protected]>
wrote:

> Hello,
>
> I've come across this SO post:
> https://stackoverflow.com/questions/72744401/why-java-turns-out-to-be-faster-than-c-in-this-simple-bubblesort-benchmark-exa
>
> The OP coded two versions of a BubbleSort application and was able to show
> that C++ is consistently slower than Java. Some of the arguments in favor
> of C++ was that:
>
> *"C++ is not always faster than Java but it can always be made faster than
> Java"*
>
> Considering a zero-gc Java application properly warmed up I think that
> this argument is flawed or at least very unrealistic for a real-life
> application development project. The OP went ahead to say:
>
> *I've tried clang++ and g++ with a variety of optimization options (-O2,
> -O3, -Os, -march=native, etc) and they all have produced slower results
> than Java. I think at this point to make C++ faster I have to dive into the
> generated assembly code and do some assembly programming. I'm wondering how
> practical is this approach (assembly programming and assembly debugging)
> when coding a large real-life application.*
>
> I must agree with the OP when he/she says that assembly programming is not
> practical and debugging assembly code generated by the C++ compiler is a
> pain in the butt. I can only imagine the time-to-market of a financial
> application developed that way.
>
> My observations have found that C++ is often slower than Java, as his/her
> simple BubbleSort benchmark demonstrates. It turns out that the HotSpot is
> able to do a fantastic job generating ultra-optimized assembly code with
> real-time application profiling information.
>
> Another point worth mentioning is that ahead-of-time compilation is very
> often much slower than just-in-time compilation. I've recently used the
> GraalVM to compile my entire Java application ahead-of-time to native code.
> When I've benchmarked my native Java application it was consistently much
> slower than my HotSpot one.
>
> Anyway, I was wondering your opinion about C++ vs Java when it comes to
> performance for finance applications.
>
> Cheers,
>
> -RB
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "mechanical-sympathy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/mechanical-sympathy/fbdd6869-66f9-455a-90ab-dd3838aec694n%40googlegroups.com
> <https://groups.google.com/d/msgid/mechanical-sympathy/fbdd6869-66f9-455a-90ab-dd3838aec694n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/mechanical-sympathy/CAD5RQ-BOGD3sX394yqCKm1fsqrwRohV5DWx6KfCRhgtE%3DAHjyQ%40mail.gmail.com.

Reply via email to