Re:The software development final exam: Computer Architectur...
by tcbawo on Tuesday October 09, 2012 @08:33AM
(#4631125)
I believe when traversing memory in a predictable, linear fashion the CPU will prefetch data. I thought the CPUs are smart enough to do that for the more complex examples as well, but maybe not for steps of 1024.
[ Parent
| on HN ]
Re:The software development final exam: Computer Architectur...
by kd0amg on Tuesday October 09, 2012 @12:39PM
(#4632493)
Intel Core architecture has a stride prefetcher, but it will not prefetch across page boundaries (which you hit pretty often with a 1k step size).
Re:The software development final exam: Computer Architectur...
by alexkus on Tuesday October 09, 2012 @05:29PM
(#4634056)
You'll hit it every time given a typical x86 4KB page size and a step of 1024*sizeof(double)=8KB.
I would guess that the example was explicitly contrived so that prefetching would be useless.
Re:The software development final exam: Computer Architectur...
by cperciva on Tuesday October 09, 2012 @09:41PM
(#4634705)
I would guess that the example was explicitly contrived so that prefetching would be useless.
Yes -- even if prefetching could happen, the first function would be faster than the second, but I thought removing the whole issue of prefetching would simplify the question.