Re:SICP Goodness – Why you don't need looping constructs
by goalieca on Friday June 29, 2018 @10:56AM
(#17424875)
My thought about hand rolling is that any loop is hand-rolled if I tell the compiler how to do things (ie not declarative). Writing out a for loop with an s+=*p++ for summing the elements in a vector is hand rolling a “reduce”. You can add all the tricks you want like changing the stride, doing simd, prefetching, but I’ve learned to let the compiler or the math/data library do its job.
For small data (MB) the compiler or library can parallelize things nicely. Bigger data (TB+) can be chewed threw by using MPI aware libraries that optimize and schedule and everything. Database work is already declarative because SQL is just so awesome. C# and java now handle fusion and streams more nicely and c++ can in-line and r-value a lot of overhead away.
Re:SICP Goodness – Why you don't need looping constructs
by jstimpfle on Friday June 29, 2018 @11:29AM
(#17425062)
Yeah you need to be careful what kind of iteration you do. Modifying pointers is likely problematic. Iterating over a range of integers on the other hand should be easy to optimize.
In most cases, it shouldn't matter and it's much more important to think about the data accesses, due to the relative slowness of memory.
Any code examples?
What I was thinking of is hand-rolling
to