3 ms·
For the curious like me who wanted to see the assembly for the Linus examples and compare https://godbolt.org/g/sqdBrf https://godbolt.org/g/sqdBrf. Most import
by WesternStar 10y ago
For the curious like me who wanted to see the assembly for the Linus examples and compare https://godbolt.org/g/sqdBrf https://godbolt.org/g/sqdBrf. Most importantly they have the exact same number of branches and their loops are exactly the same size 4 instructions on all opt levels greater than 02. The setup code for the first one is much longer.
- WesternStar 10y agoHere is also a somewhat representative example of various grid initialization pay attention to version 3 where the compiler unrolls the loop in O3 its likely the fastest version. https://godbolt.org/g/mMBhuW https://godbolt.org/g/mMBhuW