Some results from me.
Thats not enough code in the linescollide function(s) to justify branching for optimization at all, and the use of abs/max/min slows it down even more.
Having said that, im not sure if you can manage without the latter.
Method 1: 115838 colisions found in 46 ms Method 2: 115838 colisions found in 65 ms Method 3: 115838 colisions found in 72 ms Method 1: 115824 colisions found in 45 ms Method 2: 115824 colisions found in 65 ms Method 3: 115824 colisions found in 72 ms Method 1: 115908 colisions found in 46 ms Method 2: 115908 colisions found in 66 ms Method 3: 115908 colisions found in 72 ms Method 1: 115016 colisions found in 45 ms Method 2: 115016 colisions found in 65 ms Method 3: 115016 colisions found in 72 ms
Thats not enough code in the linescollide function(s) to justify branching for optimization at all, and the use of abs/max/min slows it down even more.
Having said that, im not sure if you can manage without the latter.