Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

There are column-oriented databases, like HBase or Teradata. My question is whether there are programming language implementations that store the objests/structures in a similar format when they are stored in a collection. (To improve cache locality, possibly reduce memory footprint in some cases.)

(Searching did not reveal these kind of languages for me, but probably I tried the wrong keywords.)

What I mean is the following (in Scala syntax):

case class Data(a: Int, b: Array[Byte])
var someData: Array[Data] = new Array(Data(2, new Array[Byte](2)), Data(3, new Array[Byte](3))
var someData(1).b(1) = 1.toByte

Could be represented as the following: Array for the a parts:


Array for the b parts:

---------------               -----
|byteArrayRef0|   ------>     |0|0|
---------------               -----   -------
|byteArrayRef1|   ----------------->  |0|1|0|
---------------                       -------

Object passing would require more stack space with this structure, for example to pass the only second element from someData it would require to pass the the array references (for the a and the b parts) and the index 1. Probably this is its main drawback, but I guess there might be clever solutions, or this would not be a huge problem. (The arrays should be internal implementation details, not visible, unless the container for someData is immutable. Probably arrays are not ideal for this kind of data primitives, but an ArrayList implementation would be better.)

Edit: This question is not about whether this is a good/bad idea or which implementation is better. This is only about existence -or probably also announced plans, articles if they exists. (I am quite busy currently, so cannot check the suggestions yet, but will check them during the weekend.) If my question is not clear, I'll try to reformulate it.

share|improve this question

closed as off-topic by gnat, MichaelT, GlenH7, Dynamic, psr Jul 7 at 19:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, MichaelT, GlenH7, Dynamic, psr
If this question can be reworded to fit the rules in the help center, please edit the question.

Related: What is tabular programming? - Falcon's Table structures may be close to what you are looking for. –  Yannis Rizos Jul 6 at 14:57
You are looking for a column-major order language... which are listed in the wikipedia page that I've linked. –  MichaelT Jul 7 at 0:03
Thank you both for the suggestions. I have to check the languages you mentioned, probably during the weekend I can see how they fit. (I thought for example that the array of data frames in R are stored by objects, not by their column projections. I would be happy to be proven wrong.) –  Gábor Bakos Jul 7 at 16:12
There is also the option of storing property values in tagged lists attached to each object. An object "containing" only default values has no storage allocated for storage. An object containing 1 non-default value has one list node allocated, etc. –  Frank Hileman Jul 7 at 17:25
Checked some of the languages @MichaelT mentioned, though I had not get conclusive answers yet. For me it seems the shader languages do not support custom structs, Julia and R uses column major order only for their matrix datastructures. Had no time yet to check Mathematica, Octave or Scilab. Rasmadan is probably not Turing complete. –  Gábor Bakos Jul 14 at 12:50

Browse other questions tagged or ask your own question.