Speed Issues

I’m evaluating Aspose.Tasks for a new project.

I have a .mpp file with about 150 tasks. I import the project into Aspose.Tasks and then loop through all the tasks, changing the duration of each via Task.Set. What I’m finding is that doing this process in Aspose.Tasks is much slower than using MS Project VBA by a factor of 4 or more.

I’ve already tried turning the project calculation mode to manual (in automatic mode is was far worse). Are there other things I can try to make this faster? (…Is there an alternate to Task.Set that is faster? …Is there a way to set a bunch of values in a single call?)

Thanks for any advice.

EW

Hi Erik,


Thank you for writing to Aspose Support team.

There is no other alternate to Task.Set that can be used to set multiple parameters at the same time. Switching to CalculationMode.None is another option but it will require you to set each and every parameter yourself that may not be expected to you. Have you tried this using the latest version of the API i.e. 9.5.0 as there were some further improvements to the Manual calculation mode while working with Tasks. Please try it at your end and if you still face performance issue, please share your sample console projects with us for both Aspose.Tasks as well as MS Project VBA that we can use to investigate the speed issue further at our end. Please also include your sample Project MPP/XML files with your console projects.

I have version 9.4.1.0 which was what I got from your trial version download approximately last week. How can I get the more recent version?

The slowdown is easy to demonstrate. I’ve attached a .mpp model to this post. In only has three tasks of fairly long duration.

I run code like this:

m_Project.CalculationMode = CalculationMode.Manual

Dim startTime As DateTime = DateTime.Now

For Each oneTask In m_Project.RootTask.Children
Dim currentDuration As Double = oneTask.Get(Tsk.Duration).ToDouble
Dim newDuration As Duration = m_Project.GetDuration(currentDuration * 1.5)
oneTask.Set(Tsk.Duration, newDuration)
Next

Dim processingTime As TimeSpan = (DateTime.Now - startTime)


MsgBox(processingTime.TotalSeconds)


So basically the code adds 50% to the duration of every task I find. In Aspose.Task, it took around 7 seconds to set the durations of these three values! In VBA, this took 150 milliseconds or so.

Thanks your help,

Erik


I just downloaded version 9.5.0.0 which you just release two days ago it seems… It has the same speed issue.

Hi Erik,


We were able to reproduce the problem at our end with the sample file you have shared and have logged it as TASKSNET-1606 for further investigation by our Product team. We’ll update you here once there is some information or a fix version available in this regard.

Hi Erik,


We have discussed this issue with the product team and observed that CalculationMode.None combined with Project.Recalculate(), which works similar to CalculationMode.Automatic, has better performance. This causes the single re-calculation after the loop instead of re-calculation on each step. You may please give a try to the following sample code and share your feedback with us.


<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>Project m_Project = <span class=“kwrd” style=“color: rgb(0, 0, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>new<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”> Project(path + “slow.mpp”);<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
m_Project.CalculationMode = CalculationMode.None;<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>DateTime startTime = DateTime.Now;<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
<span class=“kwrd” style=“color: rgb(0, 0, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>foreach<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”> (Task oneTask <span class=“kwrd” style=“color: rgb(0, 0, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>in<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”> m_Project.RootTask.Children)<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
{<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
<span class=“kwrd” style=“color: rgb(0, 0, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>double<span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”> currentDuration = oneTask.Get(Tsk.Duration).ToDouble();<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
Duration newDuration = m_Project.GetDuration(currentDuration * 1.5);<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
oneTask.Set(Tsk.ActualDuration, newDuration);<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
}<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>m_Project.Recalculate();<br style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”><span style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre; background-color: rgb(255, 255, 255);”>
Console.WriteLine((DateTime.Now - startTime).TotalSeconds);


Please refer here for more information on calculation modes.

Thank you for your reply. In fact I DID try this, even before I wrote to you originally. My problem with this solution is the calculation doesn’t seem to work properly. For example, if I print out the project finish time after the recalc (sorry I’m in VB.NET not C#) using:

Console.WriteLine(m_Project.RootTask.Get(Tsk.Finish).ToString)

I get the correct answer if I was in “Manual” recalc mode, but not in “None” mode. In “None” mode, the finish date of the project doesn’t change, even after the explicit recalculation.

Is there a way I can make that work?

Thanks,
EW


Hi Eric,


We can observe the problem as you have stated and these seem to be limitations of the CalculationMode.None. We have further logged additional information against the logged ticket and will update you here once further information is available in this regard.

The issues you have found earlier (filed as TASKSNET-1606) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.