
Data-Oriented Hash Table - luu
http://www.reedbeta.com/blog/2015/01/12/data-oriented-hash-table/
======
mamcx
I have read a bit about data-oriented design, and wonder if speedups could be
gain (an how?) if use .NET? Or more exactly: What if I'm in a managed
environment (like Java, .NET, etc)

~~~
Negitivefrags
In C# there are "value types" which allow more direct control of memory so you
should be able to use those to help somewhat. I don't think Java really
supports anything like that directly.

This is really the main reason why your average C++ program written naively
will tend to beat the same Java/C# program written naively.

In managed languages you spend much of your time chasing pointers around
memory.

~~~
ww520
You can pack data with primary type arrays in Java for memory (cache) friendly
processing. Or go the JNI route, with less portability.

~~~
TheLoneWolfling
"primary type array"?

Do you mean _primitive_ type array? Because in that case, a bunch of arrays of
primitives does not have the same layout and cache locality as an array of
structs of primitives.

~~~
twoodfin
Just as an aside, sometimes slicing up your arrays-of-structs into structs-of-
arrays brings big locality improvements.

Anyway, you can usefully control some aspects of how Java lays out your data,
including primitive fields:

[http://psy-lob-saw.blogspot.com/2013/05/know-thy-java-object...](http://psy-
lob-saw.blogspot.com/2013/05/know-thy-java-object-memory-layout.html)

~~~
TheLoneWolfling
And sometimes it brings big locality hits.

Layout within objects is not what I'm talking about here. What I'm talking
about is layout of objects within an array. There's no way to do an array of
<whatever>. It's an array of <primitive> or an array of <pointer to whatever>.
So much pointer-chasing!

In (e.g.) C, I can do either array-of-structs or structs-of-arrays. In Java...
I don't know any way to have an array-of-structs in Java (portably, that is).

