The execution speed too slowly, especially below method :
Hi zhencheng,
Thank you for writing to Aspose Support team.
We have tested this issue with the following sample code but were not able to observe the behavior you have mentioned. Can you please try the following with the latest version of the API and share your feedback with us? Also, it seems that the issue may be specific to your sample file. Could you also please share that with us for our further investigation? We’ll look into it and assist you further.
Sample Code:
Project project = new Project(“Blank2010.mpp”);
Task t1 = project.getRootTask().getChildren().add(“T1”);
Resource r1 = project.getResources().add();
System.out.println(new Date());
ResourceAssignment ra = project.getResourceAssignments().add(t1, r1);
System.out.println(new Date());
project.save(“resaved.mpp”, SaveFileFormat.MPP);
Hi Zhencheng,
I have modified the above sample code to display time interval in milliseconds for execution of each project.getResourceAssignments().add(asTask, resource) as shown below:
…
final long startTime = System.currentTimeMillis();
project.getResourceAssignments().add(asTask, resource);
final long endTime = System.currentTimeMillis();
System.out.println("Total execution time: " + (endTime - startTime));
…
The output file is attached here which shows an average time of about 15 ms to execute this statement in each iteration. My test machine specifications are as follows:
Processor: 2.53 GHz
RAM: 4 GB
OS: Windows 10 (64 bit)
I am afraid that issue is not re-produced here and you may test this code on some other machines for better comparison. Please feel free if you have any other query related to Aspose.Tasks.
Is it a difference between trial version and official version on performance?
Hi Zhencheng,
In trial versions, all dates are set to 2000 and the performance should be more improved as compared to the licensed version where all dates are properly calculated. Please try the license version as you will be getting wrong dates information while working with trial version without a license.
Hi,
Hi Zhencheng,
Hi Kashif,
Hi,
I ran more benchmarks with some slightly different code:
Project project = new Project(“c:\temp\project_blank.mpp”);
List resources = new ArrayList(RESOURCES_COUNT);
for (int i = 0; i < 40; i++) {
Resource resource = project.getResources().add(“aaa” + i);
resources.add(resource);
}
for (int i = 0; i < TASKS_COUNT; i++) {
Task asTask = project.getRootTask().getChildren().add("Task " + i);
Date d1 = Calendar.getInstance().getTime();
Calendar c2 = Calendar.getInstance();
c2.add(Calendar.DAY_OF_MONTH, 5);
Date d2 = c2.getTime();
asTask.set(Tsk.START, d1);
asTask.set(Tsk.FINISH, d2);
asTask.set(Tsk.UID, i);
asTask.set(Tsk.WORK, project.getDuration(8));
asTask.set(Tsk.IS_MILESTONE, new NullableBool(false));
asTask.set(Tsk.PRIORITY, 500);
asTask.set(Tsk.ACTUAL_START, d1);
asTask.set(Tsk.ACTUAL_FINISH, d2);
asTask.set(Tsk.ACTUAL_DURATION, project.getDuration(24));
asTask.set(Tsk.PERCENT_COMPLETE,90);
asTask.set(Tsk.REMAINING_WORK, project.getDuration(16));
Resource resource = resources.get(i % RESOURCES_COUNT);
project.getResourceAssignments().add(asTask, resource);
}
// Save the Project
project.save(“Project_” + RESOURCES_COUNT + “_” + TASKS_COUNT + “.mpp”, SaveFileFormat.MPP);
The findings are that Aspose Tasks Java don’t scale well at all:
50 tasks: 18 s
100 tasks: 38 s
200 tasks: 75 s
400 tasks: 222 s
600 tasks: 453 s ( ~ 17 s to write the mpp file)
800 tasks: 900 s (~ 30 s to write the mpp file).
What’s surprising is that one loop did took almost 2 seconds when reaching 800 tasks created, (~300 ms at the beginning when no task is created) which makes it hard to believe that this could scale up to 10k tasks and only take 4 seconds for a loop to complete…
My laptop config is a QuadCore (i7-2860) with 20GB RAM and SSD.
I would have gladly investigated further with a perf profiler, but since Aspose Tasks java code is obfuscated, that makes it really hard for me to dig further than the shallow observation that creating a new resource assignment is slow and doesn’t scale well…
Are you sure that the licensed lib has the same performance as the trial lib? I’m using the trial version for now. That should have changed soon, but this performance profile means that we might have to give up using Aspose Tasks for our project, which is unfortunate.
Thanks,
Etienne.
kashif.iqbal:[...]Above sample code is executed 10000 times and it is observed that getResourceAssignments() function takes minimum 3 milli seconds (ms) and maximum 650 ms. [...]
Hi Etienne,
Hi,
Hi Etienne,