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,
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,
Hi Erik,
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);
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,
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.