Most active commenters

    ←back to thread

    160 points todsacerdoti | 17 comments | | HN request time: 0.001s | source | bottom
    Show context
    jpalawaga ◴[] No.41898791[source]
    Anyone who has done a programming contest, advent of code, etc knows that the language doesn’t matter so much as your algorithm.

    Yes, the language can bring a nice speed up, or might give you better control of allocations which can save a lot of time. But in many cases, simply picking the correct algorithm will deliver you most of the performance.

    As someone who doesn’t JavaScript a lot, I’d definitely prefer a tool written in go and available on brew over something I need to invoke node and its environment for.

    replies(12): >>41898816 #>>41898879 #>>41898890 #>>41898952 #>>41899000 #>>41899028 #>>41899401 #>>41901158 #>>41901185 #>>41901525 #>>41902030 #>>41904514 #
    1. tyree731 ◴[] No.41898816[source]
    Lots of very smart people have worked very hard on Python tools written in Python, yet the rust rewrites of those tools are so much faster. Sometimes it really is the programming language.
    replies(6): >>41898834 #>>41898859 #>>41898913 #>>41898949 #>>41899003 #>>41899226 #
    2. anyfoo ◴[] No.41898834[source]
    Choosing the right algorithm effectively means optimizing runtime complexity. Then, once runtime complexity is fixed with the right algorithm, you're still left with a lot of constant factors that O-notation deliberately ignores (it's only about growth of the runtime). Sometimes, optimizing those constant factors can be significant, and then the choice of language matters. And even some details about the CPU you are targeting, and overall system architecture.
    replies(1): >>41898920 #
    3. charrondev ◴[] No.41898859[source]
    In the JavaScript world a lot of speed up comes from 3 major things as far as I can tell:

    - easier concurrency. - the fact that things are actually getting rewritten with the purpose of speeding them up. - a lot of the JS tooling getting speedups deals with heavily with string parsing, tokenizing, generating and manipulation of ASTs. Being able to have shared references to slices of strings, carefully manage when strings are copied, and have strict typing of the AST nodes you enable things to be much faster than JavaScript.

    4. jvanderbot ◴[] No.41898913[source]
    This is a very nice counterexample, but it's not actually a counter example without an example.

    Also, this was a thing before Rust. I've rewritten several things in C or Cpp for python back ends, and most pytbon performance-critical code is already an API to a shared library. You'd be surprised to run OR tools and find Fortran libraries loaded by your python code.

    replies(1): >>41898995 #
    5. o11c ◴[] No.41898920[source]
    Often languages like Javascript and Python don't allow optimal runtime complexity, because the types baked in to external interfaces fundamentally disallow the desired operation. And these languages are too slow to rewrite the core logic in the language itself.

    (but of course, the vast majority of the code, even in widely used tools, isn't properly designed for optimization in the first place)

    I only dabble in javascript, but `tsc` is abominable.

    6. jampekka ◴[] No.41898949[source]
    Python is really really slow compared to JS though.
    replies(3): >>41899001 #>>41899014 #>>41901003 #
    7. runesoerensen ◴[] No.41898995[source]
    Ruff is one example https://astral.sh/ruff
    replies(1): >>41902025 #
    8. gaganyaan ◴[] No.41899001[source]
    CPython is (though it's slowly getting better). Pypy is amazingly fast
    9. worik ◴[] No.41899003[source]
    > Lots of very smart people have worked very hard on Python tools written in Python

    Yes, I agree that is very sad

    Python is achingly slow. I know the Python people want to address this, I do not understand. Python makes sense as a scripting/job control language, and execution speed does not matter.

    As an application development language it is diabolical. For a lot of reasons, not just speed

    10. zeroonetwothree ◴[] No.41899014[source]
    I once worked on a Python system that had 50 machines dedicated to it. We were able to rewrite it in a more performant language such that it easily ran on one machine. This also allowed us to avoid all the issues distributed systems have.

    So yeah, Python is not great for systems programming

    11. bsder ◴[] No.41899226[source]
    > Lots of very smart people have worked very hard on Python tools written in Python, yet the rust rewrites of those tools are so much faster.

    So?

    Some tool got written and did its job sufficiently well that it became a bottleneck worth optimizing.

    That's a win.

    "Finishing the task" is, by far, the most difficult thing in programming. And the two biggest contributors to that are 1) simplicity of programming language and 2) convenience of ecosystem.

    Python and Javascript are so popular because they tick both boxes.

    replies(1): >>41899545 #
    12. tyree731 ◴[] No.41899545[source]
    Don’t disagree about finishing the task, but personally I don’t find more performant languages any less productive for the sort of programming I tend to do.
    replies(1): >>41899723 #
    13. bsder ◴[] No.41899723{3}[source]
    Congratulations on being a programming god. This discussion isn't for you.

    From my point of view, I'm happy if I can convince my juniors to learn a scripting language. Okay? I don't care which one--any one. I'd prefer that they learn one of the portable ones but even PowerShell is fine.

    I have seen sooooo many junior folks struggle for days to do something that is 10 lines in any scripting language.

    Those folks who program but don't know a scripting language far outnumber the rest of us.

    replies(1): >>41901234 #
    14. kukkamario ◴[] No.41901003[source]
    Node is so slow to start that python script can complete before Javascript even begins to execute.
    replies(1): >>41902074 #
    15. fredrikholm ◴[] No.41901234{4}[source]
    > I have seen sooooo many junior folks struggle for days to do something that is 10 lines in any scripting language.

    > Those folks who program but don't know a scripting language far outnumber the rest of us.

    What domain are you in? This sounds like the complete inverse of every company I've ever worked at.

    Entire products are built on Python, Node ect, and the time after the initial honeymoon phase (if it exists) is spent retrofitting types on top in order to get a handle, any handle, on the complexity that arises without static analysis and compile time errors.

    At around the same time, services start OOM'ming left and right, parallellism=1 becomes a giant bottleneck, JIT fails in one path bringing the service performance down an order of magnitude every now and then etc...

    > Congratulations on being a programming god. This discussion isn't for you.

    On the behalf of mediocre developers everywhere, a lot of us prefer statically typed languages because we are mediocre; I cannot hold thousands of implicit types and heuristics in my head at the same time. Luckily, the type system can.

    16. aragilar ◴[] No.41902025{3}[source]
    But can I write plugins for it? My understanding it is only implements a subset of the common plugins (and does not do any of the linting that pylint is useful for), so it avoids scanning the filesystem for plugins?
    17. jampekka ◴[] No.41902074{3}[source]
    For extremely simple scripts maybe. I get around 70 ms difference in startup time.

      $ time python3 -c "print('Hello world')"
      Hello world
    
      real 0m0.017s
    
      $ time node -e "console.log('Hello world')"
      Hello world
      
      real 0m0.084s