Performance issue on writing timephased data

F

fleuz

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:


Code:
--------------------
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
 
R

Rod Gill

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




fleuz 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:


Code:
--------------------
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


--
fleuz
------------------------------------------------------------------------
fleuz's Profile: http://forums.techarena.in/members/171998.htm
View this thread: http://forums.techarena.in/microsoft-project/1291092.htm

http://forums.techarena.in


__________ Information from ESET Smart Security, version of virus
signature database 4733 (20091231) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4733 (20091231) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
M

Mike Glen

Hi fleuz,

Try posting on the microsoft.public.project.developer newsgroup (forum). Please see FAQ Item: 24. Project Newsgroups. FAQs, companion products and other useful Project information can be seen at this web address: http://project.mvps.org/faqs.htm

Mike Glen
Project MVP



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:


Code:
--------------------
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
 

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