On Tue, Dec 1, 2009 at 4:36 AM, Marcelo Fukushima <[email protected]> wrote: > On Mon, Nov 30, 2009 at 10:48 PM, Jon Harrop <[email protected]> wrote: >> On Monday 30 November 2009 21:55:43 Marcelo Fukushima wrote: >>> trove uses 2 arrays (of float in this case) one holding the keys and >>> another holding the values, so it probably performs very well >> >> That's still 2x as many cache misses. > > pretty much, altough as Ismael mentioned before, you could implement > it better for ints and floats (and the shorter primitives)
I don't think the bit-width of the types have much to do with it, although it certainly do have an effect on how many elements fit in the caches. As I understand things, a greater advantage comes from the fact that same-typed keys and values can be kept in a single array. Searching a single block of memory instead of two distinct blocks has potential benefits from better pre-fetching and cache-locality. The hope is to reduce two reads from main memory, to one read from memory and one from cache. > >> >>> i remember seeing somewhere that scala has a @specialized annotation >>> that makes type parameters acts as templates. I suppose they box / >>> unbox primitives in method signatures that uses the type parameters >>> though >> >> I see. > > while i havent read it entirely yet, here's the first pointer i found > on this feature > > http://lamp.epfl.ch/~dragos/files/scala-spec.pdf > > and it'll be in the 2.8 release > >> >> -- >> Dr Jon Harrop, Flying Frog Consultancy Ltd. >> http://www.ffconsultancy.com/?e >> >> -- >> >> 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. >> >> >> > > > > -- > http://mapsdev.blogspot.com/ > Marcelo Takeshi Fukushima > > -- > > 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. > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. -- 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.
