Yeah the access is pretty random. Some keys accessed more frequently than
others. Having the data in a HashMap is pretty much exactly what I would
want.

I tried default (de)serialization of the HashMap but that was much slower
than reading the CSV.

On 19 August 2010 18:59, DanH <[email protected]> wrote:

> That's certainly an option, if the characters are from a limited
> charset so you can, eg, pack each char in 6 bits.  Then you can save/
> load an array of int.  If you need to get the chars into Strings,
> though, some non-trivial work is involved, but you could, similar to
> my "dope vector" scheme, unpack them "on demand".
>
> It would be nice to know how the strings need to be accessed -- are
> they accessed by ordinal number, searched, what?  If one is accessed
> are all accessed, or is the access random, with some never being
> accessed and others accessed frequently?
>
> On Aug 19, 11:48 am, greg <[email protected]> wrote:
> > If all the strings are less than 5 chars, have you considered packing
> > them into 4-byte integers?
> >
> > On Aug 19, 11:01 am, Mark Carter <[email protected]> wrote:
> >
> > > I've got a map of about 500 entries. Strings are all very short (less
> > > than 5 chars).
> >
> > > Its read-only data I want to read once at app-startup.
> >
> > > What's the best way to store this so that loading this data is fast?
> >
> > > I've tried storing the data in a CSV in res/raw but this takes about
> > > 700ms to parse on my N1, so I'm hoping there's a faster way...
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en

Reply via email to