xml - How do I optimize loading a lot of Strings in my android app? -
i'm working on project have dictionary list of words of english language. use list figure out if user has inputted valid word. whole list rather lengthy, talking 100k of strings, have partitioned list smaller bits. these files stored xml files , accessed assetmanager. use parser such open file:
document = documentbuilder.parse(xmlfile);
the document document object using library: org.w3c.dom.document
so problem slows down app lot, smaller partitioned files (in fact had 1 file 100k strings , crashed app immediately). should use text files instead? or instead of using assetmanager should store data in resources? or other way optimize speed matter? i'm open suggestions.
why not store word list in sqlite table? indexed-based searches. if each entry 1 word normal table fine. if using multiple words per entry, fts table (full-text-search) solution best.
if speed paramount (i.e. don't care how memory use -- unusual android app), loading words hashtable give fastest per word lookup. take time load list on startup, however.
Comments
Post a Comment