Edit/Update Speed in Different Project Versions (Why is 2007 Slower?)

B

Bill B

It seems to me that Project 2007 (Professional SP1) runs much slower than
earlier versions. I have a test project with 2400 tasks. When I run the
following code in Project 2002 or 2003, it runs in about .1 seconds. When I
run it in Project 2007, it runs in about 1.15 seconds. I have all automatic
calculation turned off in both systems.

Sub TestTasks(pj As Project)
Dim t As Task, t0 As Single
t0 = Timer
For Each t In pj.Tasks
t.Flag2 = Not t.Flag2
Next
MsgBox "Task write for " & pj.Tasks.Count & " tasks took " &
Format(Timer - t0, "00000.00")
End Sub

Can someone confirm this for me? Similar code for resource assignments
(below) seems to run even slower. There really shouldn't be any processing
going on when this code runs.

Sub TestAssmts(pj As Project)
Dim t As Task, a As Assignment, l As Long, t0 As Single, t1 As Single,
tassign As Single
t0 = Timer
pj.ProjectSummaryTask.Flag13 = True
For Each t In pj.Tasks
For Each a In t.Assignments
l = l + 1
t1 = Timer
a.Flag14 = 0
a.Number13 = 0
a.Number14 = 0
a.Number15 = 0
a.Number16 = 0
a.Number17 = 0
a.Number18 = 0
tassign = tassign + Timer - t1
Next
Next
MsgBox "Resource write took " & Format(Timer - t0, "00000.00") & ": " &
Format(tassign, "00000.00") & " to make assignments"
End Sub

Thanks,

Bill B
 
J

John

Bill B said:
It seems to me that Project 2007 (Professional SP1) runs much slower than
earlier versions. I have a test project with 2400 tasks. When I run the
following code in Project 2002 or 2003, it runs in about .1 seconds. When I
run it in Project 2007, it runs in about 1.15 seconds. I have all automatic
calculation turned off in both systems.

Sub TestTasks(pj As Project)
Dim t As Task, t0 As Single
t0 = Timer
For Each t In pj.Tasks
t.Flag2 = Not t.Flag2
Next
MsgBox "Task write for " & pj.Tasks.Count & " tasks took " &
Format(Timer - t0, "00000.00")
End Sub

Can someone confirm this for me? Similar code for resource assignments
(below) seems to run even slower. There really shouldn't be any processing
going on when this code runs.

Sub TestAssmts(pj As Project)
Dim t As Task, a As Assignment, l As Long, t0 As Single, t1 As Single,
tassign As Single
t0 = Timer
pj.ProjectSummaryTask.Flag13 = True
For Each t In pj.Tasks
For Each a In t.Assignments
l = l + 1
t1 = Timer
a.Flag14 = 0
a.Number13 = 0
a.Number14 = 0
a.Number15 = 0
a.Number16 = 0
a.Number17 = 0
a.Number18 = 0
tassign = tassign + Timer - t1
Next
Next
MsgBox "Resource write took " & Format(Timer - t0, "00000.00") & ": " &
Format(tassign, "00000.00") & " to make assignments"
End Sub

Thanks,

Bill B

Bill,
I can confirm that for some reason your code in Project 2007 takes way
longer than the same code in Project 2003. I used a test file with 2416
tasks. The macro took a whopping 140.25 seconds in 2007 and less than a
second in 2003. A couple of caveats although I don't think they make a
difference in relative terms - I do not have SP1 installed for Project
2007 and I run Project on an emulated PC.

Unfortunately I haven't worked enough with VBA in Project 2007 to have
any clues as to why it is slower but several years ago I did discover
that some methods take longer than others. For example, running through
all tasks in a file to set a flag takes significantly longer then using
selection on the whole column and setting them all at once. Normally
using background processing (operating directly on Project's objects)
runs much faster than foreground processing (selecting objects for
operating on). It's the basic difference between manually written VBA
code and recorded macro code.

However, you have to go with what works best in the current situation.
Whenever I write VBA, I look for ways to limit the data set prior to
jumping into the full code. Normally this involves a filter and then
setting the filtered set as the object to be operated on. When I am
forced to run through all tasks for a simple operation (e.g.
setting/clearing), I opt for the selection approach with EditClear or
FillDown.

John
Project MVP
 
J

Jack Dahlgren

Interesting...
There are a few things I'd investigate further if I had a copy of 2007
handy...

1) Speed while connected to project server vs. offline. I know that Project
2007 does some caching differently than Proj2003. It would be interesting to
see if the timings are different when working off-line than when connected.

2) Effect of change highlighting. I know you said that autocalc is turned
off, but change highlighting is something that gets calculated whenever there
is a task change. Changing the flag SHOULD not trigger it, but that doesn't
mean it doesn't. I'd investigate turning this on and off just because it is
something new in 2007 which doesn't exist in 2003.

3) Multi-level undo. As you may be aware, 2007 added this as a long awaited
new feature. However, to make it work it needs to store a list of
transactions somewhere, somehow. I don't know if you can turn it off to
compare before and after, but I do know that you can set all the stuff in a
macro to be bundled into a single undo operation. I think of all that I
listed so far, this is probably the most likely cause.

4) Turning off screen updates. Yes, it probably shouldn't make much
difference either, but might as well investigate all the variables.

I'd poke into these, but I don't have a machine with 2007 handy right now.
If you do further testing, please post and let me know what you find.

-Jack Dahlgren
 
R

Rod Gill

Good ideas Jack. I would try sandwiching your code with:

application.OpenUndoTransaction "SpeedMacro"
application.screenupdating=false
application.Calculation=pjManual

--Macro--

application.CloseUndoTransaction
application.screenupdating=True
application.Calculation=pjAutomatic

If this makes a big difference remove code until the culprit is found!

The transaction code consolidates all changes made by the macro into one
undo action. Select Speedmacro from the undo menu after running the code and
everything changed by the macro is undone. makes testing easier as well.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
J

Jack Dahlgren

Rod,

I am really interested to see what happens with 2007... What effect might
setting the undo level to a lower level have?

-Jack Dahlgren
 
R

Rod Gill

It shouldn't have any affect other than in memory usage. That could be
another interesting test as well. Using:

application.UndoLevels=1 at eh beginning would be interesting. The macro
transaction should simplify the undo overhead as well which is why I
suggested it.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
B

Bill B

application.UndoLevels=1 makes a (roughly) 10% difference vs. 99. Still much
slower than 2003, even with Change Highlighting disabled and Screen Updating
turned off. One thing I noticed is that it at some times the processing
reaallly slows down. I have other test code for resource assignments that
runs in a couple of seconds in 2003 that was taking 16 seconds to run in
2007. One time I ran it, the code took about 10 minutes to run. I'd had MSP
open for a long while, so I closed down 2007, restarted, and the code took
16 seconds again.

Beats me what's going on.

Bill B
 
J

Jack Dahlgren

How much memory on your machine?
Project performance is memory sensitive.
I'm not suggesting that having more memory will make it all of a sudden as
fast as 2003, but just using this as an opportunity to take a look at the
factors that influence performance.

-Jack
 
B

Bill B

2GB, Jack. With a 3.12GB dual core Pentium and lots of disk space. This
happens with a 2000 activity project. Memory shouldn't be a problem at that
level, should it?
 
R

Rod Gill

I've tested on my system and get similar results. I guess Project 2007 is
doing some extra work somewhere that 2003 is not. I suspect it's because of
the re-design to handle multiple undo levels. If it causes bigger issues
elsewhere, then maybe the team will optimize performance.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
B

Bill B

Rod,

What's the best way to let MS know about this? Do you think they actually
pay attention to the "Feedback" thing? Opening up a support incident seems
to be a waste of time because "we don't support VBA."

Thanks,

Bill B
 

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