HackerTrans
TopNewTrendsCommentsPastAskShowJobs

ziedaniel1

no profile record

comments

ziedaniel1
·hace 2 años·discuss
I did make sure to check before posting.

Good point about the signed integer overflow, though!
ziedaniel1
·hace 2 años·discuss
I used GCC and checked that it wasn't optimized out (which actually surprised me!)
ziedaniel1
·hace 2 años·discuss
Very cool idea - but unless I'm missing something, this seems very slow.

I just wrote a simple loop in C++ to sum up 0 to 2^30. With a single thread without any optimizations it runs in 1.7s on my laptop -- matching Bend's performance on an RTX 4090! With -O3 it vectorizes the loop to run in less than 80ms.

    #include <iostream>

    int main() {
      int sum = 0;
      for (int i = 0; i < 1024*1024*1024; i++) {
        sum += i; 
      }
      std::cout << sum << "\n";
      return 0;
    }