News for hackers. Stuff that matters.
Re:Sloc Cloc and Code Revisited – Optimizing an Already Fast... by nemetroid on Tuesday December 25, 2018 @09:47AM (#18757599)
I think the stuff about nested loops performing poorly is a misunderstanding. There's nothing inherently bad about nested loops. The motivation given in the previous post[0] is:

> The big breakthrough I had was after looking at the hot function I realised that storing the game events in a List of Arrays meant that we had a loop in a loop. It was however possible to flatten this into a single array of integers and reset the game every 11 turns with a simple if check.

The issue here wasn't nested loops, it was data structure overhead and poor data locality from having a lot of tiny lists (11 items each, as I understand it).

0: https://boyter.org/2017/03/golang-solution-faster-equivalent...

Re:Sloc Cloc and Code Revisited – Optimizing an Already Fast... by saagarjha on Tuesday December 25, 2018 @12:14PM (#18758113)
The author recognizes this for certain cases:

> Turns out that at this small level of nested looping there is no performance to be gained here.