<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Data Oriented Design on maladroit.dev</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/</link><description>Recent content in Data Oriented Design on maladroit.dev</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://maladroit.dev/kb/computer-engineering/data-oriented-design/index.xml" rel="self" type="application/rss+xml"/><item><title>Component Based Objects</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/component-based-objects/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/component-based-objects/</guid><description>&lt;p&gt;Thinking using components instead of inheritance can prevent needlessly linking
ideas that are unrelated to one another. Objects built this way can be processed
by component type, rather than object instance making it easier to profile the
application. Using components typically can make extending functionality easier
too since they often don&amp;rsquo;t need to modify other existing components. They either
extend it or provide alternatives.&lt;/p&gt;
&lt;h2 id="compound-objects"&gt;Compound Objects&lt;/h2&gt;
&lt;p&gt;A compound object is a base entity instance that has a list of components. The
core object merely holds the components and they communicate to each other
through it. The entity usually will update by iterating over root instances
rather than systems. This is a great start, but is not a fully component based
approach. This way the entity is more readable, reusable, and robust allowing it
to support a larger system and be reusable between projects.&lt;/p&gt;</description></item><item><title>Existential Processing</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/existential-processing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/existential-processing/</guid><description>&lt;p&gt;Existential processing attempts to provide a way to remove unnecessary querying
about whether or not to process data. For example, in most software it is common
to check for null and the verify objects are valid before processing. This
entire line of conditional checks can be removed if data could be trusted to be
in a valid state before being processed.&lt;/p&gt;
&lt;h2 id="complexity"&gt;Complexity&lt;/h2&gt;
&lt;p&gt;Cyclomatic complexity is a numeric representation of the complexity of programs,
specifically concerning flow control. In short, it is:&lt;/p&gt;</description></item><item><title>Helping the Compiler</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/helping-the-compiler/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/helping-the-compiler/</guid><description>&lt;p&gt;While compilers are good at optimizing code, they are not magic wands. It is the
engineer&amp;rsquo;s job to write code that the compiler can reason with and better apply
it&amp;rsquo;s optimizations.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;You don&amp;rsquo;t have to be an engineer to be a racing driver, but you do have to
have Mechanical Sympathy.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;- Jackie Stewart&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="reducing-order-dependence"&gt;Reducing order dependence&lt;/h2&gt;
&lt;p&gt;Compilers try doing work ahead of time to increase performance. If the compiler
cannot discern that the order of operations is unimportant, then it cannot do
work ahead of time. When translating code to an intermediate form, some
compilers will use Static Single Assignment (SSA) form. SSA assumes that a
variable is never modified after initialization and instead new variables are
created for any mutations. This is useful because it allows the compiler to work
ahead of time, this is especially true with branches.&lt;/p&gt;</description></item><item><title>Hierarchical Level of Detail &amp; Implicit State</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/hierarchical-level-of-detail-and-implicit-state/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/hierarchical-level-of-detail-and-implicit-state/</guid><description>&lt;p&gt;Hierarchical level of detail (HLOD) is a technique where an entity gains or
loses detail depending on how relevant it currently is to the user or system.
This can even be as extreme as having the entity no longer exist. Since entities
can be implicit based on their components and attributes, we can optimize their
performance by only loading those components that are relevant.&lt;/p&gt;
&lt;p&gt;For example, if 100,000 objects are being observed from a great distance away,
it is more efficient to render those objects at a lower resolution since finer
details would be impossible to perceive at that distance. The level of detail
heuristic can be fine tuned so that the most relevant objects are always at the
highest level of detail, while other objects may be reduced to a lower level.&lt;/p&gt;</description></item><item><title>Optimizations</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/optimizations/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/optimizations/</guid><description>&lt;p&gt;Optimizations cannot be done blindly, you need to know what is causing the code
to run slowly. In most cases, data movement tends to be the most expensive
operation while running algorithms or functions on data is less expensive. If
you begin development by organizing your data into arrays, you open yourself up
to many opportunities for optimization. By having such an agnostic data layout,
any improvements made can be applied in many locations with little concern for
incompatibility.&lt;/p&gt;</description></item><item><title>Relational Data Design</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/relational-data-design/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/relational-data-design/</guid><description>&lt;h2 id="representing-complex-data-in-a-computational-framework"&gt;Representing complex data in a computational framework&lt;/h2&gt;
&lt;p&gt;Data layout and structure is a constant trade-off between performance,
readability, maintenance, future-proofing, extendability, and reuse. While more
complex tables can achieve higher performance and readability, the cost becomes
future proofing, maintainability, and often scalability.&lt;/p&gt;
&lt;p&gt;Moving towards a document store type of data storage is incredibly beneficial
for their simplicity and flexibility. They are more akin to file systems where
documents are accessed by name and have few limitations on how they are
structured. This is very good for horizontal scalability since it is easy to add
more hardware when data does not need to be consistent across multiple
tables/machines.&lt;/p&gt;</description></item><item><title>Searching</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/searching/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/searching/</guid><description>&lt;p&gt;The greatest performance gain for searching is not having to search. If the
search is unnecessary then it should be avoided. Search helpers like binary
trees, hash tables, or keeping data sorted can also aid in finding rows in
tables.&lt;/p&gt;
&lt;h2 id="indexes"&gt;Indexes&lt;/h2&gt;
&lt;p&gt;The concept of an index has been around for a long time in the RDMS world. In
the SQL world, learning whether a record exists would involve building a query.
This query could start out simple, but overtime could become more complex
depending on what data is needed. Even more complex is a query that can hook
into the insertion, update, or delete operations for a table to that it could
update it&amp;rsquo;s results without needing to re-run the full query.&lt;/p&gt;</description></item><item><title>Sorting</title><link>https://maladroit.dev/kb/computer-engineering/data-oriented-design/sorting/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://maladroit.dev/kb/computer-engineering/data-oriented-design/sorting/</guid><description>&lt;p&gt;Sorting is important, however it is not always necessary and can cause more
performance problems than it&amp;rsquo;s worth. There are algorithms that may seem like
they require sorted data, but ultimately don&amp;rsquo;t. On the other hand, some
algorithms can appear to not need sorted data when in reality they do.&lt;/p&gt;
&lt;p&gt;Be aware of how accurately the data needs to be sorted since unstable sorts are
often quicker. For analog ranges, a quick sort or merge sort are slow, but will
guarantee accurate sorting. For a discrete range with a large number of
elements, a radix sort is the best fit. If the range of values is known at
compile time, then a counting sort is a very fast two-pass sort.&lt;/p&gt;</description></item></channel></rss>