Macros running much slower than before

J

Jonathan Sachs

I have a very large and complex library of macros which I developed largely
under Word 2000 and Windows 2000 on a computer with a 733MHz Pentium 3. I'm
now running them under Word 2002 and Windows XP on a laptop computer with a
2.2 GHz Pentium 4. I find that certain operations run much slower on the new
machine. "Much slower" means that a macro which used to display its first
dialog box in a second or less now typically takes 20 or 30 seconds to
display it.

Much of the slowness (but not all of it) seems to be associated with some
type of initialization. That is, the second time I run a macro it starts
much more quickly than the first time, although still not as quickly as it
did on the old machine.

The machines have the same amount of RAM (512MB). I can't identify any
differences that might account for this problem except that since the new
machine is portable, it has a slower disk, and its CPU might have a smaller
cache. I have a hard time believing that either of these factors accounts
for the drop in performance. I have watched the laptop computer's disk
activity light while these macros are starting, and it seems to be no more
busy than when the computer is idle.

What might be the problem here? How can I identify it?
..
 
W

Word Heretic

G'day "Jonathan Sachs" <[email protected]>,

tables and lists changed dramatically, stick some timers in there and
see what bits take longer. Bookmarks and x-refs seem to get a recalc
triggered on first use, maybe thats it. Vague question, vague answer
;-)

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Jonathan Sachs reckoned:
 
J

Jonathan Sachs

Word Heretic said:
G'day "Jonathan Sachs" <[email protected]>,

tables and lists changed dramatically, stick some timers in there and
see what bits take longer. Bookmarks and x-refs seem to get a recalc
triggered on first use, maybe thats it. Vague question, vague answer
;-)

I'm sorry if the question seemed vague; I provided all the information I
have. I hoped that someone would recognize this as a problem already
encountered and understood.

I tried to track down the problem in the code with little luck. The more
resolution I attempted to obtain the less delay I saw. From this negative
evidence, I can only speculate that the whole thing has slowed down for some
reason.

There did seem to be a particular delay in a routine that manages bookmarks;
it deletes all of them and then redefines about 20 based on current
conditions. When I stepped through it, though, each individual bookmark
appeared to be processed instantaneously.

Having no way to run before-and-after tests, I can only guess when some
sequence of operations is taking longer than it should.
 
W

Word Heretic

G'day "Jonathan Sachs" <[email protected]>,

Ahhh - have you seen the stopwatch code? You take the Timer at the
start and end and msgbox the results. You run your code and fiddle and
run again, or take multiple measurements along the way.

My Word VBA Beginner's Spellbook has many GENERAL optimisation tricks
that are probably applicable, as well as a full development checklist.
It is probably worth its tiny purchase price for you for just this
task :)


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Jonathan Sachs reckoned:
 
J

Jonathan Sachs

Ahhh - have you seen the stopwatch code?...

Thanks for the suggestion, but I'll pass. The cost of the book would be
trivial, but the cost of making use of it would be prohibitive.

The program will be retired in a few months, so I can't justify fixing a
problem that is not a show-stopper and would require a major debugging
project.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top