Re: Load times


Subject: Re: Load times
From: Thomas Fletcher (thomasf@qnx.com)
Date: Thu Oct 12 2000 - 07:56:12 CDT


On Wed, 11 Oct 2000, Dom Lachowicz wrote:

> I've noticed a problem with load times both before and after my XML importer
> base class. Haven't had time to check it out yet though.

Dom and all other AbiWord developers,

  I don't think that it is something different with the
XML importer layer (which is quite fast all things
considered) ... When I do a walkthrough of the system
code I end up with something like this (where each
new indentation indicates a call level that was "slow"
that I walked into to see what was going on:

App::main
 ->initialize() - fast
 ->parseCommandLine()
  -> new QNXFrame() - fast
  -> QNXFrame->initialize() - fast
  -> QNXFrame->loadDocument
   -> _loadDocument() - fast
   -> _showDocument()
    -> new FL_DocLayout()
     -> doc->addListener
      -> _tellAndMaybeAddListener()
              YIKES! ==> Start of real problem with iteration
                         upon iteration ... we walk through
                         each character in the document at
                         least twice, sometimes more.

There are a couple of things here that I have noticed.

1) We are doing a large number of new/delete's to
create/fill/use/destroy a structure in the
_tellAndMaybeAddListener() code. This was my first
thought at what might be slowing the system down.
Re-using a data structure and filling it in would
be better.

2) But then I took a closer look at the code
pListener->populate within _tellAndMaybeAddListener().
                Holy cow man, killer iterations!!
We iterate through each character in a block checking
it for special characterness, then when we add character
runs, we iterate through each character to get its width,
then we iterate through each character width summing them
to get the total width. There is more iteration in there,
but at this point I was totally beginning to understand why
my load times were killer, and why working on a long
document you start to really feel some lag time in the
interface behaviour (paging and scrolling around).

What can we do about this? I've spent most of my time
on AbiWord in the platform specific portions of the
code and have really stayed away from the internal
representation. Is there someone out there who would
be willing to

1) Do a profile of the system to find the hotspots in
   loading documents ... essentially if you hack the
   code to put an exit(0) at the return of parseCommandLine()
   in the App specific code, you will the data which
   is most interesting.

2) Examine how we can streamline this code to only do
   the calculations necessary, or to be able to hook
   the calculated values along with the runs so that
   we don't always have to calculate them (no help
   in loading, but once loaded then the performace
   should increase). The big thing is that when
   we make an editing change, it _seems_ (from my
   quick view) to iterate the entire document, even
   if that isn't really required.

For my benchmarking I've been using Interview.abw
which is a tough one since it is multi-columns and
requires more calculations than a single page doc.

Thomas ... looking for insight and volunteers!
 
> >From: Thomas Fletcher <thomasf@qnx.com>
> >To: abiword-dev@abisource.com
> >Subject: Load times
> >Date: Wed, 11 Oct 2000 11:06:06 -0400
> >
> >I'm just wondering if anyone else has found that the
> >load times for documents is horrendous for AbiWord?
> >Also seems to be a real problem scrolling through
> >a document of any real size.
> >
> >Just wondering if anyone had seen this before I go
> >taking a look through the debugger to see what I
> >can see.
> >
> >Thomas
> >-------------------------------------------------------------
> >Thomas (toe-mah) Fletcher QNX Software Systems
> >thomasf@qnx.com Neutrino Development Group
> >(613)-591-0931 http://www.qnx.com/~thomasf
> >
> >
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
>

-------------------------------------------------------------
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf



This archive was generated by hypermail 2b25 : Thu Oct 12 2000 - 07:52:07 CDT