This CodeRage session by Janez Atmapuri Makovsek shows how you can use the MtxVec library to speed up the Delphi code by 200x.
The key concept is here, once you get the data to the right memory hierarchy level, you need instructions that take advantage of the available memory bandwidth.
- Only possible with AVX (Advanced Vector Extensions)
- Instruction Set and CPU cache rely on the assumption that the elements of the array are accessed consecutively in increasing order.
And here is how you can increase the speed of your Delphi code using the MtxVec
Result is amazing!
- Running time 0.18s
- Speed up factor: 204x