• stevecrox@kbin.social
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      1 year ago

      Its even better…

      In C/C++ you have to create/destroy objects, deal with pointers (**& for the win!). As a result the average C/C++ developer has to think about alot more than the average Java developer.

      In a previous job there were a lot of legacy C and C++ applications. They wanted to replace some components with Java local applications because Eclipse RCP was the new cool thing.

      So we would build it and then have 2-4 weeks for performance tuning. It basically involved one person from the team attaching Yourkit profiler and either nudging code to pure OO or C like procedural at bottleneck points.

      Every single time the result used less CPU and RAM than the C/C++ application when running through the original applications test packs. Even when those applications had gone through multiple rounds of performance tuning.

      We got given some time to figure out why, our conclusion was while any one part of the Java application would be slower, the reduced mental load lead to better performance in total.

  • philm@programming.dev
    link
    fedilink
    arrow-up
    9
    ·
    1 year ago

    Every language is fast, as long as it can be somehow (at least) jit compiled, and you’re not allocating much.

  • CollectiveOfCells@programming.dev
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    1 year ago

    When I worked for Amazon, someone had created a command line tool to be used in builds, but repeatedly starting up JVMs is painfully slow. I rewrote the app in C++ and it could be invoked 81 times vs one invocation of Java version.

    If I need speed, I’ll use C++. If I need developer productivity, I’ll use Ruby.

    • snowe@programming.dev
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      Why in the world would you rewrite it when you could take an hour and get it compiling with graalvm and it would be just as fast as c++?

      • Xgamer4@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        1 year ago

        Tbf he’s also suggesting that Ruby is the most dev friendly language he could use, so I’m already a bit skeptical lol

        • snowe@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          I mean, I agree with them on that. It’s very dev friendly. You definitely shouldn’t be building large scale apps in it, but it’s more readable than almost every single language out there. But rewriting a whole app in a new language instead of just using the tools available to get the best of both worlds is just a bad idea.

        • snowe@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          It’s pretty easy to use. If you are using a lot of reflection you might have trouble, but if you’re using a standard large framework like spring, quarkus, or micronaut you’ll be fine. Quarkus makes it dead simple honestly. We deploy all of our Kotlin lambdas on AWS using Graal. It’s faster than node and much easier to write safe code.

        • snowe@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          I don’t know why you would think that. GraalVM can compile tiny tiny packages, and you can easily remove features from the JVM if you don’t need them. It’s a terrible myth that JVM means massive binaries.

  • FriendOfFalcons@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    This is actually a very cool and insightful blog post. I’d have liked if the code was worked better into the written text however. I mean it didn’t dive deep into it’s Java usage or the specifics of the JVM, other than it being very well optimized for short lived objects.

    However, the precise performance numbers should be taken with a grain of salt. I’d classify this as a micro benchmark and those can often be influenced by stuff like cache locality and other small details and could look quite different on other machines.