Aspose.Words.net Upgrade Performance Degradation

Good morning, we have an older Aspose license (18.1) and are considering re-purchasing new licenses that would take us to 24.5. While running some preliminary testing on an unlicensed package, I’m noticing about a 50% performance degradation, however.

My test is pretty simple, read a document template from a local folder, merge it against a pre-built data table of data, and save the resultant file as a PDF to another local folder. In order to get some real-world numbers, I’m doing this 1000 times. Then I’m doing 5 runs (of 1000) and taking the average number of seconds per run.

Using Aspose.Words 18.1, this takes 126 seconds on average. Using Aspose.Words 24.5, this takes 191 seconds on average. I’ve also tried several older versions. The times are listed below.

18.1 - 126 seconds
19.12 - 161 seconds
20.12 - 172 seconds
21.12 - 143 seconds
22.12 - 153 seconds
23.12 - 184 seconds
24.5 - 191 seconds

While we’d like to upgrade to take advantage of new features and fixes, I’m hesitant to recommend doing so if the performance is going to take this hard of a hit. Are these standard performance expectations, or is there something I should be doing to make the later versions run faster?

I have seen other threads on this forum about similar performance issues, but from what I can see they are mostly around the Java version of Aspose, and they seem to all resolve with a new fix being issued. Apparently that’s not the case for the .net version though.

Any help would be appreciated as we assess moving to a new version. Thank you.

@mattmac If possible could you please attach your template, sample data and code you are using for testing? We will check the scenario on our side and provide you more information.
It is seen that the 24.5 version is about 50% slower in your scenario, but this performance degradation looks acceptable for 6 years or development. Most likely some more complicated and a bit slower algorithms are required to render your document to PDF. But it would be better if you provide a sample application your are using for testing.

Thank you,

I can’t provide the original template, as it contains confidential information, but I put together a very simple template to test with. However, when I ran this template this morning, the problem is even more apparent. With 18.1 the same test as before took 10 seconds on average. With 24.5, it took 70 seconds on average. With a template this simple, I wouldn’t think the PDF rendering would be so different. I also tried the same test while commenting out the line to save to PDF, and there is still a pretty large performance gap between the versions.

Here is the test code:

using System.Data;

DirectoryInfo di = new DirectoryInfo(@"D:\Temp\MergeTest");

var dt = new DataTable();
dt.Columns.Add("MailedAddressLine1");
dt.Columns.Add("MailedAddressLine2");
dt.Columns.Add("MailedAddressLine3");
dt.Columns.Add("MailedAddressLine4");
dt.Columns.Add("MailedAddressLine5");
dt.Columns.Add("MailedAddressLine6");
dt.Columns.Add("MailedAddressLine7");

DataRow dataRow = dt.NewRow();
dataRow["MailedAddressLine1"] = "Line1";
dataRow["MailedAddressLine2"] = "Line2";
dataRow["MailedAddressLine3"] = "Line3";
dataRow["MailedAddressLine4"] = "Line4";
dataRow["MailedAddressLine5"] = "Line5";
dataRow["MailedAddressLine6"] = "Line6";
dataRow["MailedAddressLine7"] = "Line7";

dt.Rows.Add(dataRow);

double seconds = 0;
int times = 5;
for (int j = 0; j < times; j++)
{
    foreach (FileInfo file in di.GetFiles()) // clean up the files from the previous run
    {
        file.Delete();
    }

    int max = 1000;
    Console.WriteLine(DateTime.Now.ToString());
    DateTime now = DateTime.Now;
    for (int i = 0; i < max; i++)
    {
        Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\Temp\MergeTest.docx");
        doc.MailMerge.Execute(dt);

        doc.Save($@"D:\Temp\MergeTest\{i}.pdf", Aspose.Words.SaveFormat.Pdf); // remove this line to test the merge alone.
    }
    Console.WriteLine(DateTime.Now.ToString());
    Console.WriteLine($"{j} {(DateTime.Now - now).TotalSeconds} seconds.");
    seconds += (DateTime.Now - now).TotalSeconds;
}
dt.Dispose();
Console.WriteLine($"Average Seconds: {seconds / times}");

MergeTest.docx (13.2 KB)

@mattmac
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-26946

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.