On my first implementation I used a DOM-parser for my XML (Flickr, 500 images), and it easily took about a minute to get through. I now use a SAX-parser, and it's less than a second. The speedup was tremendous, so it can definitely be worth your time, at least to test the difference!
-- Mark Gjøl On Aug 16, 4:35 pm, Fabrizio Giudici <fabrizio.giud...@tidalwave.it> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 8/16/10 16:02 , Davide wrote:> Hi, > > > I have seen that xml parsing is very slow. Using sax would be better, > > but benchmark show that sax work only 30% > > faster as dom. Is right? Is faster if I construct a "DOM" using sax? > > > To reduce time i like to cache xml file. Caching it as xml is not a > > good idea because the parsing time is there again > > the secondo time. > > > Should I use sqllite? Is faster? Is an idea to use an > > ObjectOutputStream? Can I put in asset a file maked by > > ObjectOutputStream > > or the serialized objects can be different in different mobile hardware? > > Davide, have you run some precise test so you are sure you've spotted > the bottleneck? Just to be sure that it's really XML the problem (and > not I/O). JSON could be an alternative. I've run some tests with > serialization and theoretically works (I exchanged objects between > Android and a JavaSE app), but it's somewhat brittle. Also, I'm not > sure it's fast because introspection is not fast on Android (it might > be different with 2.2). Also consider JDom / Jaxen as an alternate XML > parser, might be worth while compare their performance. > > - -- > Fabrizio Giudici - Java Architect, Project Manager > Tidalwave s.a.s. - "We make Java work. Everywhere." > java.net/blog/fabriziogiudici -www.tidalwave.it/people > fabrizio.giud...@tidalwave.it > -----BEGIN PGP SIGNATURE----- > Version: GnuPG/MacGPG2 v2.0.14 (Darwin) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAkxpTMMACgkQeDweFqgUGxdHiwCgne+CB+ZbtRZxLLN0VjH9ppZK > pPEAoKC5cyf8MwUAl46+pdAGugg6/nES > =gE71 > -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en