3 ms·
The issue is that splitting up work into different blocks wrecks your L1 cache and locality of data. So if your code is: A(data) B(data) C(data)
by dragontamer 5y ago
The issue is that splitting up work into different blocks wrecks your L1 cache and locality of data.
So if your code is:
A(data)
B(data)
C(data)
Doing A(data1), B(data1), C(data1) then A(data2), B(data2), C(data2) is much much faster than A(data1), A(data2), B(data1), B(data2), C(data1), C(data2).
In most cases anyway (assuming data1 and data2 have a portion that fits somewhere in the cache hierarchy).
So even if you are doing parallel execution, it ends up being a lot slower than sequential.
--------
The goal of parallel processing is to actually get faster in terms of CPU time. Just grabbing concurrency techniques can be counterproductive.