task.Set(Tsk.Duration, value); & task.Set(Tsk.Start, value);

Hello,

I am experiencing a performance problem when I include duration and date on tasks.
I have the project with about three thousand tasks, and when I include the duration and the date in the tasks, the process greatly increases the total time of the execution of the process.

In the task.Set method (Tsk.Duration, value);
is a the first point that increases the execution time.

In the task.Set method (Tsk.Start, value);
is a second point that increases the execution time.

In a project with about three thousand tasks the process took 1 hour and 2 minutes to finish.
But when I run without assigning duration and without the date it takes 23 seconds to generate the file.
That is, it increases the process time from 23 seconds to 1 hour and 2 minutes when I use both methods:
task.Set (Tsk.Duration, value);
task.Set (Tsk.Start, value);

How can I improve this time by assigning duration and date?

Follow the image print-performance.png to further explain the code snippet.
print-desempenho.png (134.7 KB)

Follow the code:

private void setStartFinishValue(Task task, DateTime start, DateTime finish, double duration, Project AsposeData)
{
if (start != null && start > DateTime.MinValue)
setDateValue(task, Tsk.Start, PrjAsposeUtils.StartTime(start));

if (duration >= 0)
task.Set(Tsk.Duration, AsposeData.GetDuration(duration, TimeUnitType.Day));

if (task.Get(Tsk.IsManual))
{
if (start != null && start > DateTime.MinValue)
setDateValue(task, Tsk.ManualStart, task.Get(Tsk.Start));
if (duration >= 0)
task.Set(Tsk.ManualDuration, task.Get(Tsk.Duration));
}
}

private void setDateValue(Task task, Key<DateTime, TaskKey> key, DateTime value)
{
if (value != null && value > DateTime.MinValue)
task.Set(key, value);
else
task.Set(key, task.ParentProject.Get(AsposeProject.Prj.StartDate));

}

@Helem,

In project calculation mode Auto, recalculations are made when change is made to tasks dates/durations. You can try using CalculationMode.None but in that case you will have to set other properties yourself. You can, however, share complete sample code with us that we can run at our end for looking into it further and assisting you.