Oh having the debugger attached always have a significant impact on
performance.

Always remember, once you say the word "performance" there should be a real
device involved that is driving the work.

On Wed, Jul 22, 2009 at 12:57 PM, gnugu <[email protected]> wrote:

>
> > Just creating 1000 objects isn't going to take 45 seconds, it sounds like
> I was running it in the emulator with the debugger attached. I'll
> check logs and try the profiler.
>
> Thanks.
>
> On Jul 22, 12:02 pm, Dianne Hackborn <[email protected]> wrote:
> > Just creating 1000 objects isn't going to take 45 seconds, it sounds like
> > you have something really bad going on somewhere.  With it taking that
> > amount of time, you will probably quickly see some serious hot spots if
> you
> > run the profiler.
> >
> > Also if you are seeing log messages about the GC running during that
> time,
> > this means that something in your code is creating tons and tons of
> > temporary objects.  Again the profiler should help a lot in tracking this
> > down.
> >
> >
> >
> > On Wed, Jul 22, 2009 at 11:39 AM, gnugu <[email protected]> wrote:
> >
> > > Dianne,
> >
> > > It is not reading and writing that's slow.
> >
> > > I have a class that has Notes field (ArrayList<Note>). I wrote my test
> > > to create 1000 note objects and add it took 45 seconds.
> > > Because I can't get XML string out of DOM Document I can't use the
> > > Document as my storage for notes which leaves me with creating all
> > > these objects as I read the XML.
> >
> > > It would be ideal for me to use MySQL to store the notes but then I
> > > would want to encrypt the table as a whole rather then individual
> > > records.
> >
> > > My own binary format might work if I create my own data reader that
> > > would work on my binary data. That's a lot of work.
> >
> > > Hmm, I wonder if I could simply encrypt the database file. But then
> > > how do I feed it to DatabaseHelper?
> >
> > > On Jul 22, 11:26 am, Dianne Hackborn <[email protected]> wrote:
> > > > Which part is slow, reading or writing?  If it is writing, just stay
> the
> > > > heck away from the standard XML writers, they are horrendous.  There
> is a
> > > > FastXmlSerializer with limited functionality that you could copy out
> of
> > > the
> > > > source code for your own use:
> >
> > > >
> http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...
> >
> > > > That said, XML is just pretty intrinsically inefficient to read and
> > > write.
> > > > I have been yelled at more than once about using it at all. :)  If
> the
> > > > amount of data you are storing is relatively large, you may want to
> just
> > > use
> > > > your own binary format.  Yes, this does require a lot more work to
> deal
> > > with
> > > > compatibility as the format changes and such, but often that is worth
> it,
> >
> > > > On Wed, Jul 22, 2009 at 9:23 AM, gnugu <[email protected]> wrote:
> >
> > > > > Hi,
> > > > > I'm working on an application where I want to save bunch of
> > > > > information in the XML file. I am not using MySQL because I want
> all
> > > > > the info to be encrypted and in one place. I don't know how this
> could
> > > > > be done in the data base.
> >
> > > > > I was thinking that I would use DOM Document for my data adapter to
> > > > > bind with ListView. But I found out that there is no way of getting
> > > > > the XML out of DOM Document to save it to the file!
> >
> > > > > So now I use SAX to read XML and create bunch of objects one for
> each
> > > > > piece of data in memory.
> >
> > > > > The SDK Guide in Designing for Performance says to avoid creating
> > > > > objects (http://developer.android.com/guide/practices/design/
> > > > > performance.html#object_creation<
> > >http://developer.android.com/guide/practices/design/%0Aperformance.ht..
> .>
> > > > > ).
> >
> > > > > I understand and agree and even proved that the performance sucks
> if I
> > > > > do it the way I described above.
> >
> > > > > What other choice there might be? Anybody has any suggestions how I
> > > > > could save bunch of notes and have them all encrypted with ONE
> > > > > password as a key base? I know I could use that one key to encrypt
> > > > > every database row, but then changing the password would be
> difficult.
> >
> > > > > Any suggestions?
> >
> > > > > Thanks.
> >
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > [email protected]
> >
> > > > Note: please don't send private questions to me, as I don't have time
> to
> > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > questions should be posted on public forums, where I and others can
> see
> > > and
> > > > answer them.
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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