Hello,

I'm very interested in this issue too.
We also want to hold very large list of small fixed structures in memory.
There is very large (somehow segmented) routing graph in our scenario.
Every segment has list of nodes with properties, list of edges with
properties, and maybe some additional info.
We want to create very large file on disk and mmap particular segments
of graph into memory (some JNI code).
Every node and edge has some fixed structure so the natural approach
in C-style is array of structures.
As JVM doesn't know anything about structures (AFAIK), our workarround
is structure (object) of primitive arrays.
So instead of accessing "nodes[i].property" we'll try to do it this
way: "nodes.getPropertyArray()[i]".
With a bit of JNI hacking in custom mmap library it could be possible.
I hope so. :)

But primitive structures would be much better for cache coherency, I guess.



On Mon, Dec 7, 2009 at 6:26 PM, Joe.Whitney <[email protected]> wrote:
> Hello,
>
> I am trying to understand what barriers, if any, exist to supporting C-
> style structs in JVM languages.  I have considered trying to add
> support of such to Clojure for my own research programming (I work on
> local search algorithms for bioinformatics applications).  I assume
> that the right way to do this will involve emitting byte code, but I
> have not yet studied the byte code or its verification by the JVM in
> enough detail.  I thought this group might be able to answer the
> following questions before I invest time in a fruitless search for a
> good solution:
>
> 1) Is there any inherent limitation in the bytecode, or the JVM
> verification algorithm, which makes it impractical to represent
> structured, non-reference types?  Intuitively it seems that functions
> and operations on structs are reducible to functions and operations on
> basic types (int, float and friends).  But, while C# supports structs,
> Java does not and I have not seen any indication that it will, and I
> have not seen a JVM language which does either.  (Maybe Scala does?
> Not familiar enough with it to be sure).  I can't tell if this is just
> for "religious" reasons, but it seems to me an obviously useful
> feature and there should be a good reason it isn't included.
>
> 2) If this has already been implemented for some language, can someone
> provide a link to details of how it was implemented?
>
> This feature is very important for certain algorithmic applications,
> where one wants to store a very large number of small records -- the
> memory/performance penalty (especially memory) of having one or more
> extra pointers per record using reference types (Objects) is really
> frustrating.  I'm sure this must be well-trodden ground for JVM
> language implementors but I haven't been able to track down a
> comprehensive discussion online.
>
> Many thanks in advance for your insights,
>
> Joe
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "JVM Languages" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/jvm-languages?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.


Reply via email to