• ☆ Yσɠƚԋσʂ ☆@lemmy.mlOP
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    Typically this is true, but it’s certainly possible to get comparable performance with functional style. Carp, which I linked above, basically uses the same approach to memory management as Rust. It doesn’t rely on GC.

    I also find that for most cases it really doesn’t matter all that much unless you’re in a specific domain like writing drivers, making a game engine, etc. Computers are plenty fast nowadays, and ergonomics tend to be more important than raw performance.

    • balsoft@lemmy.ml
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Typically this is true, but it’s certainly possible to get comparable performance with functional style

      It’s possible, but you have to specifically write code that’s fast, rather than idiomatic or ergonomic, and you have to know what you’re doing. At that point, you may have been better off writing it in something else. I feel like OCaml is good at this because it allows you to write abstractions and main control flow in a functional way and hot paths in an imperative way without switching language, but so is Rust.

      Carp, which I linked above, basically uses the same approach to memory management as Rust. It doesn’t rely on GC.

      I’ll take a look, thanks!

      I also find that for most cases it really doesn’t matter all that much unless you’re in a specific domain like writing drivers, making a game engine, etc. Computers are plenty fast nowadays, and ergonomics tend to be more important than raw performance.

      I mostly agree with you, e.g. Haskell and Clojure, despite being “slow”, are plenty fast for what they’re used for. On the other hand, I’m very much annoyed when “user-facing” software takes way too long to load or do simple tasks. Java in particular is pretty bad at this: JOSM (Java OpenStreetMap editor) takes longer to load than my entire desktop startup, including a window manager and browser. Unfortunately it’s also the best editor around, so I pretty much have to use it to edit OSM, but it still annoys me to no end. Unnecessary computations, IO inefficiencies and layers of wrapping also affect the power consumption quite noticeably.