DATA-ORIENTED DESIGN The hardware will thank you.

If you wish to submit an article, please contact support@dataorienteddesign.com for details.


Lots of good resources linked from this site by Daniele Bartolini: Data Oriented Design Resources

Data-Oriented Design book - online version

Data-Oriented Design book (2013 beta version) - PDF download
This is a free resource. Feel free to read, copy, download, upload, print, burn to CD, hand to someone on a pen drive, but do not claim the work is your own, or charge anyone for the right to read the material.

Data-Oriented Design book - 2018 paperback version

FIRST PREV : PAGE 0 : NEXT LAST

Things to consider : #07 - Wasted Cycles 03/12/2011:15:49:26

Wasted cycles are ones where the CPU does nothing, not cycles that produce results that are not used.

example 1
c = a > b ? a : b;

like this, the code is simple and wastes few cycles

example 2
c = 500msQuery() ? 500msCalculationIfTrue() : 500msCalculationIfFalse();

In this case, we don't determine which function to call until the expensive query has finished. This line uses the least number of cycles to produce a result in c, but isn't fast.

example 3
bQuery = 500msQuery()
tValue = 500msCalculationIfTrue();
fValue = 500msCalculationIfFalse();
c = bQuery ? tValue : fValue;

In this example, it can be possible to execute all three functions in parallel, only joining in the final use when combining into a value to be assigned to c. This technique uses 50% more cycles, but gets done in 50% the time.

This technique is not always appropriate, don't forget to think about the numbers involved. This technique is also known as predication.