• 1 Post
  • 22 Comments
Joined 1 year ago
cake
Cake day: July 2nd, 2023

help-circle
  • I shouldn’t have used C++ as the example. Even C would work. I agree with everything you’re saying, but the original premise. I think if you put ASM vs C, C++, rust, etc, performance would fall near 50/50.

    I’m not the best assembly guy, and I’m not advocating we all write it. But I always felt that the compiler optimization assumption was wrong or weak. Everything would be aligned nicely for my sanity, not performance =]


  • jas0n@lemmy.worldtoRetroGaming@lemmy.worldHow hard could it be?
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    22 days ago

    I feel like that’s only true if I was asked to “write the assembly for this c++ program.” If I’m actually implementing something big in assembly, I’m not going to do 90% of the craziness someone might be tempted to do in c++. Something that is super easy in c++ doesn’t mean it’s easy for the CPU. Writing assembly, I’m going to do what’s easy for the CPU (and efficient) because, now, I’m in the same domain.

    The bottom line is cranking up the optimization level can get you a 2-5x win. Using memory efficiently can give you a 10-100x win.












  • jas0n@lemmy.worldtoProgrammer Humor@programming.devC++
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    5 months ago

    Just watched this. Thank you. I think I’d agree with most of what he says there. I like trying languages, and I did try rust. I didn’t like fighting with the compiler, but once I was done fighting the compiler, I was somehow 98% done with the project. It kind of felt like magic in that way. There are lots of great ideas in there, but I didn’t stick with it. A little too much for me in the end. One of my favorite parts C is how simple it is. Like you would never be able to show me a line of C I couldn’t understand.

    That said, I’ve fallen in love a language called Odin. Odin has a unique take on allocators in general. It actually gives you even more control than C while providing language support for the more basic containers like dynamic arrays and maps.


  • Hahaha. I knew I was wrong about the polymorphism there. You used big words and I’m a grug c programmer =]

    We use those generic containers in c as well. Just, that we roll our own.

    Move semantics in the general idea of ownership I can see more of a use for.

    I would just emphasize that manual memory management really isn’t nearly as scary as it’s made out to be. So, it’s frustrating to see the ridiculous lengths people go to to avoid it at the expense of everything else.


  • Maybe I’m wrong, but aren’t move semantics mostly to aid with smart pointers and move constructors an optimization to avoid copy constructors? Neither of which exist in c.

    I’m not sure what collection type you’re referring to, but most c programmers would probably agree that polymorphism isn’t a good thing.



  • jas0n@lemmy.worldtoProgrammer Humor@programming.devC++
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    5 months ago

    Preach brother, I don’t think that’s a hot take at all. I’ve become almost twice as productive since moving from c++ to c. I think I made the change when I was looking into virtual destructors and I was thinking, “at what point am I solving a problem the language is creating?” Another good example of this is move semantics. It’s only a solution to a problem the language invented.

    My hot take: The general fear of pointers needs to die.




  • You can still write plain html websites, and they would be super fast! But that’s not how we do things damnit! I need to implement feature x. Do I spend all day rolling my own lean version? Fuck no. I download a 5-ton JavaScript library that already has that feature, and I fuck off the rest of the day.

    You are correct on one thing. The math does not add up at all.

    The root cause is the current meta of software development. It’s bloat. Software is so ungodly bloated today because we’ve been taught since as long as I can remember that hardware is so fast nowadays that we don’t need to care about performance. Because of this mindset, many of the best practices that we were taught work directly against performance (OOP was a mistake. Fight me).

    There might be overhead on the ad tracking bullshit… Sure. But, if developers cared about performance, that ad tracking can be fast, too ;]

    How long should it really take to render a webpage? That should be near instant. If modern games can render a full 3D landscape over 100 times a second, surely a wall of text and some images can be done in under 1 second, right?

    This is a problem in all software. For a simple example, I remember Microsoft word from 20 years ago being quite snappy on the desktops of the time. And by comparison, we are running supercomputers today. A cheap android phone would blow that desktop out of the water. Yet, somehow, word is a dog now…


  • Yeah, that makes sense. It used to not be a partisan thing to be an NRA member either. But I suppose I can say that about any bullshit culture war issue nowadays. This whole politics as a team sport thing is cancer.

    Owning a gun just seems like another way to show support for your team. I’ve got a sneaking suspicion that if it were somehow illegal to tell people that you own a gun, firearm sales would plummet. Otherwise, how would anyone know how cool they are?