News for hackers. Stuff that matters.
Re:ClojureScript and optimized C [video] by mpweiher on Monday November 28, 2016 @02:03PM (#13057572)
I think the problem is that it's using doubles, which JavaScript VMs feel free to optimise to ints. If I change the C code to long, I get the following:

   marcel@sarek[tmp]cc -Os sumints.c && ./a.out 
   49999995000000
    Elapsed time: 0.000031 millis
The original:

   marcel@sarek[tmp]cc -Os orig.c && ./a.out 
   49999995000000
   Elapsed time: 8.276664 millis
That's a factor 266989 difference, if anyone cares :)
Re:ClojureScript and optimized C [video] by jjnoakes on Monday November 28, 2016 @02:35PM (#13057773)
Can you post your code, compiler, and the disassembly from main()? The only way I believe these numbers is if your compiler optimized the loop away to a constant.
Re:ClojureScript and optimized C [video] by mpweiher on Monday November 28, 2016 @03:34PM (#13058163)
That's exactly what it (clang) did.
Re:ClojureScript and optimized C [video] by jjnoakes on Monday November 28, 2016 @03:47PM (#13058267)
You should update your YouTube comment too :)