>write c99. >normal looking code. >write "idiomatic c++" (what trannies want you to do). >slow crap

>write c99
>normal looking code
>write "idiomatic c++" (what trannies want you to do)
>slow crap
>write like "c with classes, templates and constexpr"
>blazing fast

Beware Cat Shirt $21.68

Rise, Grind, Banana Find Shirt $21.68

Beware Cat Shirt $21.68

  1. 2 years ago
    Anonymous

    >genius discoverers streams are slower than printf
    Can I subscribe to your blog to get daily insights?

    • 2 years ago
      Anonymous

      You didn't noticed the loop is not unrolled? std::for_each version is even worse

      • 2 years ago
        Anonymous

        >crying about loops not being unrolled
        What are cache and branch prediction?

        • 2 years ago
          Anonymous

          Why are you worried about loop unrolling on a routine that needs to call the fricking kernel? The only reason it's not getting unrolled here is because the compiler recognizes that it's a complex enough routine to not be worth it.

          >coping this hard while not understanding programming at all yet wanting to have an opinion

      • 2 years ago
        Anonymous

        Why are you worried about loop unrolling on a routine that needs to call the fricking kernel? The only reason it's not getting unrolled here is because the compiler recognizes that it's a complex enough routine to not be worth it.

  2. 2 years ago
    Anonymous

    >gcc 12.2 -O3
    >gcc 7.2 -O2
    >gcc 12.2 -O3
    nice bait thread

    • 2 years ago
      Anonymous

      Exactly the same code generated.

      • 2 years ago
        Anonymous

        ok, and?

        • 2 years ago
          Anonymous

          Still slow.

      • 2 years ago
        Anonymous

        >exactly the same code
        >j-just ignore the outline view

  3. 2 years ago
    Anonymous

    >C arrays instead of std::array
    Is this C++98?

    • 2 years ago
      Anonymous

      std::array is the most idiotic thing after std::begin() and std::end() and you can't even have arrays with implicit size with std::array. The only reason you might want to use std::array is for passing as argument and returning, which, in fact, this could be easily done by making the C++ only decay array to pointers explicitly by using static_cast, but no, lets create an bullshit class in STL for nothing.

      • 2 years ago
        Anonymous

        I don't know if it depends on c++ version or what, but you can easily write your own code which generates array of implicit size.
        But it seems like a relatively minor thing to get annoyed about. Surely there are use cases for arrays of explicit size... right?

      • 2 years ago
        Anonymous

        std::array does deduce size in C++17. And you won't have to write a size function like a moron because it's in std.

      • 2 years ago
        Anonymous

        there is make_array which deduces for you at the very least

  4. 2 years ago
    Anonymous

    I guess flexibility comes at a slight speed cost. The real question is is this actually significant enough to not be worth it?

    • 2 years ago
      Anonymous

      As things scales up, it will makes difference.

      >slow crap
      Did you benchmark it?

      I do not need to even run it. Loops not unrolled, memory not contiguous (not cache efficient), function calls that could be inlined everywhere, its obviously slower than the "C with classes" style, and its not just because cout vs printf. The only doubt that i have is with "C with classes" vs C99, because at least C99 put everything on the same region.
      True that for this particular C++ code is not even important, but this demonstrates how things will scale up as you write your code.

      • 2 years ago
        Anonymous

        The lack of flexibility also scales up similarly. You're missing the point. Much easier to log with streams. If you need to spend more man hours to do it with printf, but save an irrelevant amount of runtime, then it's not worth it.

  5. 2 years ago
    Anonymous

    >it's another printf is faster than cout for small data thread
    WE KNOW! YOU'RE USING IOSTREAM WRONG!

  6. 2 years ago
    Anonymous

    >Be OP
    >Be a huge dick sucking homosexual
    >Be born into a world of countless tools and innovations
    >Find one specific tool I dislike/find problems with
    >Decide to cry and piss my pants about it instead of just using what I prefer

  7. 2 years ago
    Anonymous

    >slow crap
    Did you benchmark it?

  8. 2 years ago
    Anonymous

    >benchmarking (f)printf vs cout
    L M A O

  9. 2 years ago
    Anonymous

    Tell me you never wrote C++ without telling me you never wrote C++

  10. 2 years ago
    Anonymous

    >more asm means slower execution
    poo tards itt replying to an obvious bait

  11. 2 years ago
    Anonymous

    Wow, it's almost like calling the `<<` operator defined in the standard headers imports more code into your translation unit than calling a function whose implementation is external. Everyone knows streams are slow, you even use `std::endl` here which doesn't make the implementation identical as you'd need `fflush` on the C version.

  12. 2 years ago
    Anonymous

    >nojob morons stir shit day number ?????

  13. 2 years ago
    Anonymous

    Why didn't you check for errors?

  14. 2 years ago
    Anonymous

    Those who put a newline after function return type deserve a special place in hell

  15. 2 years ago
    Anonymous

    any way to improve the rust version? https://godbolt.org/z/zjzGs3vEv

    • 2 years ago
      Anonymous

      Doesn't Rust support C FFI? Just import printf and fprintf.

Your email address will not be published. Required fields are marked *