this post was submitted on 14 Jul 2024
485 points (96.7% liked)

linuxmemes

21263 readers
482 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.

  • Please report posts and comments that break these rules!

    founded 1 year ago
    MODERATORS
     
    (page 2) 30 comments
    sorted by: hot top controversial new old
    [–] [email protected] 21 points 4 months ago (2 children)

    I used c++ in college, and I think it's useful to know c because so much relies on it. That said if I'm going to do something that needs performance I'll look to go first, then rust if go isn't a good fit, but that's mostly because I know go better. Both are excellent languages.

    If I just need something functional quick and easily I'll turn to Python. If I need a net service quick node.js is great.

    [–] [email protected] 15 points 4 months ago* (last edited 4 months ago) (1 children)

    I use c++ whenever possible because I like classes and objects and having more versatility to make more dynamic programs. I made an entire kernel that way one time because fuck the police.

    load more comments (1 replies)
    load more comments (1 replies)
    [–] [email protected] 10 points 4 months ago (1 children)

    Honestly, love to see a lil CatchyOS representation. So far my favorite Arch flavor.

    [–] [email protected] 6 points 4 months ago

    It's fitting for this image too since CachyOS kernel + packages + defaults go zoom.

    [–] [email protected] 29 points 4 months ago (2 children)

    As someone who only codes solutions for himself I don't relate. All the extra time I would spend writting a C solution it would never attone the runtime loses of doing it in maybe python.

    [–] [email protected] 10 points 4 months ago

    I used to write extensively with C++, but it has been a long time since speed mattered that much to one of my applications. I still marvel at the cache-level optimizations some people come up with, but I'm in the same mindset as you now.

    My workload split of Data Movement vs Data Transformation is like 95:5 these days, which means almost all the optimizations I do are changing batch/cache/page/filter settings. I can do that in any language with http bindings, so I choose those that are faster to write.

    [–] [email protected] 31 points 4 months ago* (last edited 4 months ago) (1 children)

    Anyway, this is only relevant if you're writing only for yourself. It's your poor users who suffer for your expediency.

    load more comments (1 replies)
    [–] [email protected] 34 points 4 months ago (7 children)

    Damn, that's a fast ass-cheetah!

    What with passenger planes like the one depicted typically going 575-600 mph and the bar only 3 times as long, that dude is sprinting at upto 200mph!

    (Link is to classic xkcd comic, not furry porn)

    [–] [email protected] 18 points 4 months ago

    Link is to classic xkcd comic, not furry porn

    Damn, you got my hopes up for a second there.

    [–] [email protected] 4 points 4 months ago (1 children)
    [–] [email protected] 4 points 4 months ago

    Probably, but it's much more fun to imagine a cheetah hauling ass at the speed of a modern supercar 😂

    [–] [email protected] 12 points 4 months ago* (last edited 4 months ago)

    (Link is to classic xkcd comic, not furry porn)

    I am both disappointed and pleased.

    load more comments (4 replies)
    [–] [email protected] 65 points 4 months ago (16 children)

    Honestly, it's still ridiculous to me how slow Python, Java, JS, Ruby etc. continue to feel, even after decades of hardware optimizations. You'd think their slowness would stop being relevant at some point, because processors and whatnot have become magnitudes faster, but you can still feel it quite well, when something was implemented in one of those.

    [–] [email protected] 24 points 4 months ago (1 children)

    There are a few reasons for this, some of the most important being:

    • The languages were not designed with speed primarily in mind and as such made some design decisions that fundamentally cannot be optimized around
    • Authors of programs in these languages prioritize things other than performance when writing the programs.

    Speed is not just about processors becoming faster - this is a large part of why DSA is important to learn as a programmer.

    load more comments (1 replies)
    [–] [email protected] 15 points 4 months ago (3 children)

    That's because it's not relevant. Speed can be compensated for either by caching or outsourcing your load, if there's such a huge need to process large amount of data quickly. In day to day work I can't say I have ever ran into issues because code was executing slow. Normal operation Python is more than capable of keeping up.

    On the other side of the coin you have memory management, buff and stack overflows and general issues almost exclusive to C, which is something you don't have to worry about as much with higher level languages. Development with Python is simply faster and safer. We as developers have different tools, and we should use them for their appropriate purpose. You can drive nails with a rock as well, but you generally don't see carpenters doing this all day.

    [–] [email protected] 10 points 4 months ago* (last edited 4 months ago) (3 children)

    You can sometimes deal with performance issues by caching, if you want to trade one hard problem for another (cache invalidation). There's plenty of cases where that's not a solution though. I recently had a 1ns time budget on a change. That kind of optimization is fun/impossible to do in Python and straightforward to accomplish Rust or C/C++ once you've set up your measurements.

    load more comments (3 replies)
    load more comments (1 replies)
    [–] [email protected] 41 points 4 months ago (2 children)

    Many of these have C-bindings for their libraries, which means that slowness is caused by bad code (such as making a for loop with a C-call for each iteration instead of once for the whole loop).

    I am no coder, but it is my experience that bad code can be slow regardless of language used.

    [–] [email protected] 30 points 4 months ago* (last edited 4 months ago) (2 children)

    Bad code can certainly be part of it. The average skill level of those coding C/C++/Rust tends to be higher. And modern programs typically use hundreds of libraries, so even if your own code is immaculate, not all of your dependencies will be.

    But there's other reasons, too:

    • Python, Java etc. execute their compiler/interpreter while the program is running.
    • CLIs are magnitudes slower, because these languages require a runtime to be launched before executing the CLI logic.
    • GUIs and simulations stutter around, because these languages use garbage collection for memory management.
    • And then just death by a thousand paper cuts. For example, when iterating over text, you can't tell it to just give you a view/pointer into the existing memory of the text. Instead, it copies each snippet of text you want to process into new memory.
      And when working with multiple threads in Java, it is considered best practice to always clone memory of basically anything you touch. Like, that's good code and its performance will be mediocre. Also, you better don't think about using multiple threads in Python+JS. For those two, even parallelism was an afterthought.

    Well, and then all of the above feeds back into all the libraries not being performant. There's no chance to use the languages for performance-critical stuff, so no one bothers optimizing the libraries.

    [–] [email protected] 19 points 4 months ago (3 children)

    Java is still significantly faster and more efficient than Python tho - because it has ahead-of-time optimizations and is not executing plain text.

    [–] [email protected] 9 points 4 months ago (1 children)

    Idk numpy go brrrrrrrrrr. I think it's more just the right tool for the right job. Most languages have areas they excel at, and areas where they're weaker, siloing yourself into one and thinking it's faster for every implementation seems short sighted.

    load more comments (1 replies)
    [–] [email protected] 4 points 4 months ago (5 children)

    Faster, sure. Efficient, fuck no. With Java you have to run around and write ton of boiler plate code to do something simplest in nature.

    [–] [email protected] 9 points 4 months ago (1 children)

    Could say the same for C/C++.

    But yeah I'd like it if the features given by Lombok were standard in the language though it's not a big deal these days since adding Lombok support is very trivial.

    [–] [email protected] 3 points 4 months ago (1 children)

    You shouldn’t use Lombok, as it uses non-public internal Java APIs, which is why it breaks every release. At one point we had a bug with Lombok that only resolved if you restarted the application. Switching off of Lombok resolved the issue.

    Just switch to kotlin. You can even just use Kotlin as a library if you really want (just for POJOs), but at this point Kotlin is just better than Java in almost every way.

    load more comments (1 replies)
    load more comments (4 replies)
    load more comments (1 replies)
    [–] [email protected] 11 points 4 months ago (1 children)

    For example, when iterating over text, you can't tell it to just give you a view/pointer into the existing memory of the text. Instead, it copies each snippet of text you want to process into new memory.

    As someone used to embedded programming, this sounds horrific.

    [–] [email protected] 7 points 4 months ago (2 children)

    Yep. I used to code a lot in JVM languages, then started learning Rust. My initial reaction was "Why the hell does Rust have two string types?".
    Then I learned that it's for representing actual memory vs. view and what that meant. Since then I'm thinking "Why the hell do JVM languages not have two string types?".

    load more comments (2 replies)
    [–] [email protected] 7 points 4 months ago

    At least with Java, its the over(ab)use of Reflections and stuff like dependency injection that slows things down to a crawl.

    load more comments (13 replies)
    [–] [email protected] 17 points 4 months ago (2 children)

    https://github.com/hykilpikonna/hyfetch

    I like hyfetch because it has the largest os compatibility.

    It feels like the spiritual successor to neofetch tbh.

    [–] [email protected] 4 points 4 months ago

    yeah and it allows for queering up the distro logo, which I absolutely love.

    load more comments (1 replies)
    [–] [email protected] 19 points 4 months ago (1 children)

    And I like rust programs for their memory safety

    load more comments (1 replies)
    load more comments
    view more: ‹ prev next ›