Performance Issue on writing Timephased Data

V

Valerio

Someone knows why writing timephased data through code has such a bad
performance?

I've have develop a procedure to import the assignment timephased data from
a excel file into project.

This procedure is a Project add-in written in c#.

Here's a sample of the code that runs for each assignment:

oRCProject.Application.OptionsCalculation(false, false, false, false, false,
Missing.Value, false, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value);
for (int iQuarter = 0; iQuarter < aQuarters.Count; iQuarter++)
{
MSProject.TimeScaleValues oNewAssTSV = oNewAss.TimeScaleData(dtQuarterStart,
dtQuarterFinish,
MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
MSProject.PjTimescaleUnit.pjTimescaleQuarters, 1);
double dQuarterValue = Convert.ToDouble(aQuarters[iQuarter]);
oNewAssTSV[1].Value = dQuarterValue;
}

The last line of code has a very long execution time, 90% of the elaboration
time has been occupied by these code.
Furthermore the execution time grows at each call, passing from a 10ms to
300ms after 3000 hits.
Obviously it's not only a write of a value, there're other operations
performed.
Someone know what kinds of operations are performed by this call?
There's a way to disable these operations and postpone them after the finish
of the procedure?

Thanks
Valerio
 
R

Rod Gill

I responded in your post to the other NG, I don't think the answer has
changed!

I would first write this coder in VBA and get it working. Add-ins are
inherently slower than VBA which runs in the same process as the App. If VBA
is slow, then Project is the problem. If not, then your addin is.

I don't understand the MSProject.TimeScaleValues oNewAssTSV =
oNewAss.TimeScaleData(dtQuarterStart line:

If you work with the timescalevalues of a new Assignment variable without
first pointing the variable to an existing assignment, you will get very
strange results which I think is what you have!

Get it working in VBA then port to Visual Studio. This process is obviously
much faster and easier when writing in VB, which is what I recommend for
office Add-in development.


--

Rod Gill
Microsoft MVP for Project - http://www.project-systems.co.nz

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




Valerio said:
Someone knows why writing timephased data through code has such a bad
performance?

I've have develop a procedure to import the assignment timephased data
from
a excel file into project.

This procedure is a Project add-in written in c#.

Here's a sample of the code that runs for each assignment:

oRCProject.Application.OptionsCalculation(false, false, false, false,
false,
Missing.Value, false, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value);
for (int iQuarter = 0; iQuarter < aQuarters.Count; iQuarter++)
{
MSProject.TimeScaleValues oNewAssTSV =
oNewAss.TimeScaleData(dtQuarterStart,
dtQuarterFinish,
MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
MSProject.PjTimescaleUnit.pjTimescaleQuarters, 1);
double dQuarterValue = Convert.ToDouble(aQuarters[iQuarter]);
oNewAssTSV[1].Value = dQuarterValue;
}

The last line of code has a very long execution time, 90% of the
elaboration
time has been occupied by these code.
Furthermore the execution time grows at each call, passing from a 10ms to
300ms after 3000 hits.
Obviously it's not only a write of a value, there're other operations
performed.
Someone know what kinds of operations are performed by this call?
There's a way to disable these operations and postpone them after the
finish
of the procedure?

Thanks
Valerio

__________ Information from ESET Smart Security, version of virus
signature database 4757 (20100109) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4757 (20100109) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

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

Similar Threads


Top