[android-developers] XML parsing slow ... cache!

2010-08-16 Thread Davide
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?



-- 
  _|  _.    o  _|  _
 (_| (_| \/ | (_| (/_

-- 
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


Re: [android-developers] XML parsing slow ... cache!

2010-08-16 Thread Fabrizio Giudici

-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