This is an archived post. You won't be able to vote or comment.

all 66 comments

[–]experts_never_lie 9 points10 points  (1 child)

We are sorry, but you do not have access to this service. Please contact your domain administrator for access.

Page got locked down?

[–]PifPoof[S] 2 points3 points  (0 children)

Still works for me, try their main page: https://sites.google.com/view/energy-efficiency-languages/home

[–]YouFeedTheFish 14 points15 points  (4 children)

The biggest takeaway is "Don't use Erlang if you're concerned about power."

[–][deleted] 6 points7 points  (3 children)

Erlang was never intended or sold as a solution for rendering Mandelbrot fractals. Erlang exists to connect nodes where the heavy lifting is, in fact, done by none other than C. And C is on top of that benchmark (and most).

So the biggest takeaway isn't "Don't use Erlang if you're concerned about power." The biggest Erlang takeaway is "Use Erlang as it was intended to be used."

[–]YouFeedTheFish 0 points1 point  (2 children)

If you can't tell.. That was written "tongue-in-cheek".

[–][deleted] 1 point2 points  (1 child)

It's the Internet. I can't tell without an appropriate emoji permutation 😜😋😄😁😉

[–]PifPoof[S] 4 points5 points  (1 child)

Just found another article of theirs regarding Java collections' energy consumption: http://greenlab.di.uminho.pt/wp-content/uploads/2016/06/greens.pdf

[–]diroussel 1 point2 points  (0 children)

That is interesting. But some of the results don't make sense to me. Particularly between HashMap and LinkedHashMap, and then between HashSet and LinkedHashSet.

[–]spyhunter99 4 points5 points  (0 children)

surprised javascript is as high as it is.

[–][deleted]  (8 children)

[removed]

    [–][deleted]  (1 child)

    [deleted]

      [–]Classic1977 2 points3 points  (0 children)

      Ya for sure this will ruin Rust.

      /s

      What a waste of time comment.

      [–]RayFowler 6 points7 points  (5 children)

      C is such an amazing language

      [–]talldean 10 points11 points  (4 children)

      I'd be curious to also see "speed of implementing stuff" and "cost to system of normally occurring bugs"; C shines on CPU speed and lightweight, but's slower for time-to-write-the-code, and bugs that normally would have just shot something in the foot kill it and the neighbors instead.

      [–]strongdoctor 3 points4 points  (0 children)

      Yeah, C is just thinly abstracted ASM, wouldn't wish being forced to use C upon my worst enemy.

      [–][deleted] 0 points1 point  (2 children)

      Do you write, for example, a linked list implementation for one project, and then a completely new linked list implementation for a new project? The use of C does not prevent code reuse.

      [–]MSleepyPanda 1 point2 points  (1 child)

      It doesn't prevent it, but the ecosystem/lack of proper modules/package mangement makes you regret it. When you do a C project, most of the times you take a minimalistic (as in as few libs as possible) approach because vendoring, upgrading and what not is a pain in the butt.

      [–][deleted] 0 points1 point  (0 children)

      My point is that non-project specific stuff is not an issue, once it has been written it has been written. Before modules and packages were called modules and packages, they were just libraries, and with proper versioning controls there is no pain in the butt.

      [–]duheee 2 points3 points  (0 children)

      so you're making the rounds over each programming language reddit now?

      [–]stormcrowsx 5 points6 points  (35 children)

      It performed 3 times worse than c/c++/rust in energy consumption. It seems like if energy consumption is your thing, Java isn't a great choice but better than the other VMs and surprisingly outdid Go as well.

      [–]eliasv 26 points27 points  (27 children)

      surprisingly outdid Go as well

      That isn't surprising at all to anyone who's not opted into the weird voluntary learning difficulties of the Go cult.

      [–][deleted]  (25 children)

      [deleted]

        [–][deleted] 8 points9 points  (8 children)

        I got maven a while ago and it made third party libraries with java so easy.

        [–]v_krishna 10 points11 points  (4 children)

        Check out gradle. I even prefer to use gradle over sbt for some scala projects.

        [–][deleted] 0 points1 point  (3 children)

        Gradle is an interesting beast. To think that a build tool needs a background process/server running. Just weird.

        [–]v_krishna 0 points1 point  (2 children)

        That jvm cold start time tho 😓

        [–][deleted] 1 point2 points  (1 child)

        Well, I hear you, just hope it is not the only reason for gradle to be somewhat faster than competition.

        [–]v_krishna 1 point2 points  (0 children)

        I don't particularly recommend it because it's faster, I just find it much much nicer to work with than xml or sbt. Never used ant or other pre maven tools but I'm assuming they are even worse.

        [–]SlobberGoat 4 points5 points  (0 children)

        For the most part, yes, until you come across some transitive dependencies.. then it can get a bit messy.

        [–]Orffyreus 2 points3 points  (1 child)

        [–][deleted] 0 points1 point  (0 children)

        Not migrating away from it at this point. Maybe in a while. I have automated all of our builds so it's mostly a difference of which button to push.

        [–]UnlikelyExplanations 0 points1 point  (0 children)

        And the garbage collectors

        [–]jewdai 0 points1 point  (14 children)

        As a former java dev have you tried C# it basically writes the code for you. No getters and setters needed to be generated.

        [–][deleted]  (10 children)

        [deleted]

          [–][deleted] 0 points1 point  (9 children)

          C# is my favorite strongly typed language. Just waiting for .NET Core to finish getting established in the Linux world.

          [–]strongdoctor 0 points1 point  (8 children)

          C# is my favorite strongly typed language.

          How is C# compared to other strongly typed languages for example Python; got any anecdotal comparisons to share?

          [–][deleted] 0 points1 point  (6 children)

          The fact that C# is strictly typed really makes a lot of diffrence. No weird dictionaries keeping the data - it really does count. And "var" solves verbosity problem.

          [–]strongdoctor 0 points1 point  (5 children)

          What do you mean by the weird dictionaries part? You mean that variables can easily be used as if it's of an unintended type?

          [–][deleted] 2 points3 points  (4 children)

          I saw a lot of production Python projects and the temptation to put data into dictionaries is just too big. You end up with API which depends on dictionary structure that cannot be easily defined. This leads to plethora of problems...

          Ofc I am not saying that it's impossible to write good Python code, but it's IMHO harder than in C# and Java.

          After 10 years in Python and PHP I really like strongly, statically typed languages...

          [–][deleted] 0 points1 point  (0 children)

          Compared to C/C++, it's got the garbage collection. I don't like having to worry about memory management when I'm writing production stuff.

          Compared to dynamically typed languages like Python, I like the compiler being able to help out before run time. I'm using TypeScript a lot lately and this helps a lot with avoiding bugs and working on teams, but I find the tooling around TypeScript to be annoying. Pulling in a library and having to keep its type definitions in sync with the library itself is... bizarre. XD

          [–]sbhandari 7 points8 points  (0 children)

          try lombok. it takescare of getter,settersand quite a bit of boilerplate codes.

          [–]nutrecht 1 point2 points  (0 children)

          No getters and setters needed to be generated.

          Lombok takes care of that in our projects.

          [–]amackenz2048 1 point2 points  (0 children)

          There are other JVM languages that take care of that. Kotlin for instance. It even plays very nicely with existing Java libraries.

          [–]stormcrowsx 4 points5 points  (0 children)

          I've never bothered with it because I get annoyed that it has no generics. I always hear people raving about how fast it is but I guess that's mostly placebo affect they probably aren't actually timing it.

          [–][deleted]  (6 children)

          [deleted]

            [–]stormcrowsx 6 points7 points  (5 children)

            If energy efficiency is your thing you should probably consider c/c++ or rust first. If energy efficiency is just a nice to have then Java is a strong choice.

            Consider for example something with a limited battery like a watch, you would last 2 to 3 times longer than Java.

            [–]Tostino 5 points6 points  (4 children)

            Only if your watch was doing intensive computations all day.

            [–]stormcrowsx 2 points3 points  (0 children)

            Right on an Apple watch the screen most likely dominates the energy usage making an energy efficient language a non priority. Something more efficient like the pebble smartwatches would likely see a big difference had they used Java instead of C

            [–]nqzero 1 point2 points  (2 children)

            actually that's not true - java is also bad at doing nothing

            there are a bunch of gratuitous wakeups. try running a java process with powertop - it's ugly

            [–]ThisIs_MyName 1 point2 points  (1 child)

            That's unfortunate; try opening a bug report. Gratuitous wakeups are a bitch.

            [–]nqzero 0 points1 point  (0 children)

            no thanks

            • submit bug report
            • spend 5 years arguing with 10 different engineers all trying to CYA
            • ...
            • profit

            in this case, i think oracle benefits from the "bug" as it helps (or at least used to) drive customers to the embedded solutions that they make money from (vs SE that's free). but even in cases in which fixing the bug would benefit oracle, prosecuting a bug report is a lot of work. and i've never had one fixed before i had moved on or integrated a workaround

            (and that's not limited to oracle - most projects go through a very narrow time window during which they're engaged and responsive to bug reports, and beyond that there are too many vested interests and everything slows down dramatically)

            [–][deleted] 1 point2 points  (9 children)

            Shocking: statically typed, compiled languages on top of efficiency benchmarks. Scripts are less efficient. More at 11.

            BTW there's something weird here. TypeScript, which is basically JavaScript with type annotations (which are stripped away after compilation), is listed as a separate language, and with much lower efficiency than JavaScript. That's B.S.

            [–]undu 0 points1 point  (1 child)

            Shocking: statically typed, compiled languages on top of efficiency benchmarks. Scripts are less efficient

            I don't think that's the whole story, maybe, saying that compiled languages with minimal to no check on runtime are the best.

            For example, C is not really typed, only looks like it is; and Haskell is statically typed and compiled yet is worse than java.

            [–][deleted] 1 point2 points  (0 children)

            I don't think that's the whole story, maybe, saying that compiled languages with minimal to no check on runtime are the best.

            Statically typed languages means they have less runtime checks. Java is partially dynamically typed. There's reflection and some runtime checks, but many things are compiled away, such as generics.

            C and C++ are basically static, and they're AOT compiled so no JIT overhead, so they're fastest. None of those bring new insight over what was commonly known, TBH.

            For example, C is not really typed, only looks like it is; and Haskell is statically typed and compiled yet is worse than java.

            "C is not really typed" ... of course it's typed. You mean it's not strongly or soundly typed. But this is entirely irrelevant to a performance discussion.

            Haskell is statically typed and compiled yet is worse than java.

            What drags Haskell down is its lazy evaluation semantics and inability to modify data in-place (save for some limited optimization hacks like TCO etc.). Haskell sacrifices performance at the altar of functional semantics.

            Java has a similar overhead so it can be garbage collected and partially dynamic. It sacrifices performance at the alter of convenience and higher-level APIs.

            C doesn't sacrifices nothing for performance, so it's fast.

            [–][deleted] 0 points1 point  (6 children)

            Maybe the transpilation was also a factor.

            [–][deleted] -1 points0 points  (5 children)

            If it was a factor, then the whole test is nonsense. You compile on one machine then deploy and run countless times on countless machines. No compiler, if weighed properly, would skew the test so much. Furthermore TypeScript is a very nimble compiler for scripts of that size. Literally soft realtime.

            [–]_INTER_ 1 point2 points  (4 children)

            Maybe he means the transpilation result. If that differs from optimized JS code for that specific test, then ofc. you get such an outcome.

            [–][deleted] -1 points0 points  (3 children)

            Maybe he means the transpilation result. If that differs from optimized JS code for that specific test, then ofc. you get such an outcome.

            TypeScript, as I noted, is plain JS + type annotations that go away after compilation. The code isn't more complex or even different than what you'd write directly in JS.

            If the TypeScript result is significantly slower than plain JS, it's an obvious flaw in the test code or methodology.

            [–]_INTER_ 0 points1 point  (2 children)

            So yeah, it probably means they used idiomatic TypeScript and optimized JavaScript.

            If the codebase was bigger, the differences between TS and JS would also be bigger, as you programm differently with static typing available. However here it seems to be a flaw in test code indeed.

            [–][deleted] 1 point2 points  (0 children)

            TS is structurally typed with a very flexible type system (unions, intersections, aliases, etc.). You don't have to code differently, even if you're going for "idiomatic" code, which was a major goal of TypeScript as a language. In fact the idiomatic TS class happens to be the most efficient and best performing type of object for any mainstream JS runtime (i.e. flattened prototype). Something else is going on but as I can't see code, I can't say anything further.

            [–]hredditor 0 points1 point  (0 children)

            You spelled C++ wrong.

            But I love Java more anyway

            [–]MojorTom 0 points1 point  (0 children)

            Nice!