No internet connection
  1. Home

Comments for https://horstmann.com/unblog/2022-01-06/index.html

By System @system
    2022-02-01 12:52:59.615Z
    • 8 comments
    1. J
      Petr Janeček @JanecekPetr
        2022-02-01 12:52:59.692Z

        Okay, so the server results say it's the same.
        And yet, one obvious difference is the GC. Does it make a difference (mainly for the parallel version) to run with -XX:+UseParallelGC?

        1. KHeinz Kabutz @kabutz
            2022-02-01 16:33:30.844Z

            GC is not the bottleneck, ergo, it is pretty much irrelevant which algorithm we use. I just used the defaults (Throughput for Java 8 and G1 for Java 17). Since it's not close to the bottleneck, it does not make a difference.

            1. PPeter Veentjer @pveentjer
                2022-02-07 05:17:53.930Z

                Nitpick warning: Even if there is no garbage being created, it doesn't mean that the GC algorithm can't have an impact. E.g with ZGC there is overhead when dereferencing a pointer from the heap due to the load barrier.

                1. KHeinz Kabutz @kabutz
                    2022-02-07 07:10:59.891Z2022-02-07 09:29:07.119Z

                    The original article shows a completely pointless benchmark, measuring an exponential time algorithm that has a logarithmic time version, run on inappropriate hardware, all just to generate clicks for the original author.

                    And we're worrying about what GC algorithm was used ...

                    1. JPetr Janeček @JanecekPetr
                        2022-02-07 08:11:27.826Z

                        Gentlemen! We're all professionals. Calm down.

                        I believe we all know Java 17 is considerably faster for many operations (and it still doesn't matter as my applications are generally DB-bound and/or IO-bound). But this is a (provocative and not very deep) article about a potential regression I could not understand at first sight, so I wondered aloud whether the difference might be G1. It's not and it was pretty clear once I gave it a second sight. I didn't dig deeper once I've seen Mr. Kabutz server results, though.

                        Mr. Ventjeer's general remark about GCs having their own costs (with different GCs having different costs in different places) is obviously true and might be interesting to other readers.

                        Let's keep it there :).

                        1. KHeinz Kabutz @kabutz
                            2022-02-07 09:28:13.295Z

                            Right, and according to my measurements on a decent piece of hardware, there is no difference.

                            You are correct though - if there was more object allocation, then the difference between G1 / ZGC / Throughput would show. In that case it would make sense to run the benchmark with at least the same GC.

                            1. LKartik Ohri @lucifer
                                2022-02-07 10:16:31.848Z

                                Hi! Can you share the specs of the server you ran the benchmark on ?

                                Actually, I too was intrigued by the original post and wondered what whether the post was correct or not. Thus, I had written a similar JMH benchmark a couple of months ago. https://github.com/amCap1712/17vs8 .

                                I ran it on a server with Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz CPU and 64GB RAM. (Not sure whether this is decent hardware or not) My results were similar to the original post: https://gist.github.com/amCap1712/d4ce26356e19f0bf8b7e044463b51851#file-benchmark-results. (Please ignore the remaining dis-assemblies, those were part of a wild goose chase on recursion vs iteration on Java 8 and 17.) However, its a multi tenant machine and I do not have enough know on how to prep a machine for benchmarks so was unsure of the results. As you have shown, those were indeed wrong.

                                1. KHeinz Kabutz @kabutz
                                    2022-02-07 11:09:32.233Z

                                    Here is what I use for my benchmarks: https://www.hetzner.com/dedicated-rootserver/ax41-nvme