Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Performance issues in Project 2010 (2007) API vs Project 2003

$
0
0

I have created very simple VBA script that reproduces the regression between MS Project 2003 and MS Project 2010(2007). The script opens new MS Project document, adds 3 tasks, to each of them adds 200 resources and to every resource calendar assign 10 days as non-working. When I run it in MS Project 2003 (all updates applied), it shows  0.915s, under MS Project 2007 it shows 138.826s. Only the total duration of

.Calendar.Period(d, d).Working = False

calls is measured. Seeing similar degradation in performance on MS Project 2010 as well.

    Dim i As Integer
    Dim i2 As Integer
    Dim d As Date
    Dim oTask As MSProject.Task
    
    pjApp.Visible = True
    pjApp.FileNew
    pjApp.ProjectSummaryInfo Start:=#1/1/2000#
    
    pjApp.Calculation = pjManual
    If Application.Version >= 12 Then pjApp.UndoLevels = 1
    pjApp.ScreenUpdating = False
    
    For i = 1 To 3
        Set oTask = pjApp.ActiveProject.Tasks.Add(i)
        oTask.Start = #1/1/2000#
        oTask.Finish = #11/24/2012#
        For i2 = 1 To 200
            oTask.Resources.Add (i2)
        Next i2
    Next i
    
    For i = 1 To 200
        With pjApp.ActiveProject.Resources(i)
            For i2 = 1 To 10
                d = DateAdd("d", i2, #1/1/2000#)
                'BOTTLENECK START
                .Calendar.Period(d, d).Working = False
                'BOTTLENECK END
            Next i2
        End With
    Next i
    
    MsgBox "Done"
    
    If Application.Version >= 12 Then pjApp.UndoLevels = 20
    pjApp.Calculation = pjAutomatic
    pjApp.ScreenUpdating = True

What can we do to avoid the overhead? I have Application.Calculation set to manual, I also tried UndoLevel set to 1, disabled screen updating, but I had no success.


Viewing all articles
Browse latest Browse all 5347

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>