Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a good article, because it illustrates the counter-intuitive aspect of computer programming. We would think initially that they both should take the same amount of time, but due to the way information is represented in the computer, the times are vastly different.


What would be even better is if the compiler could realize that the loops are independent of each other and compiled either way to the better machine code. I don't think that'd be possible with C, but possibly C# or Java could have the JIT engine recognize such a scenario and make the proper optimization.



Oh cool, thanks for sharing. I learn something new every day here...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: