Aspose 11 has performance downgrade a lot compared to Aspose 10.5

Hi Support,

Just run a simple Unit test to find the document creation time difference between Aspose 11 and Aspose 10.5, to my suprise, the performance downgrade is significant, and the document creation time is tripled almost:

Aspose 10.5:

The generated PDF document size is 2529KB, and time cost is 68 seconds.

Aspose 11:

The PDF document size is 2434KB, and time cost is 202 seconds.

What happened to Aspose 11? Why it take too much time? Please clarify.

Thanks & regards.

public class TestAsposeScalability
{
    private static final String LONG_TEXT = "This year, the CDL Performance Engineering Community will share a series of good articles we’ve found useful to you each month. Every articles we shared has been carefully selected and studied. For the following two months, we will start from DB2 and Agile Performance Engineering topics. We have also created a forum topic for each article for you to share your impressions and questions, so feel free to click on the relevant forum link and join the discussion! Wish you all Happy reading!";
    private static final java.awt.geom.Rectangle2D.Float IMAGE_BOUNDS = new java.awt.geom.Rectangle2D.Float( 0, 0, 300, 300);

    private void setupLicense() throws Exception
    {
        License license = new License();
        InputStream licstream = WordCOMDriver.class.getResourceAsStream( "Aspose.Words.lic"); //$NON-NLS-1$
        license.setLicense( licstream);
    }

    private void writeDocument( int recordsCount, String baseFolder) throws Exception
    {
        Document doc = new Document();

        DocumentBuilder builder = new DocumentBuilder( doc);

        builder.getParagraphFormat().setStyleIdentifier( StyleIdentifier.TITLE);
        builder.writeln( "Test Scalability");

        builder.getParagraphFormat().setStyleIdentifier( StyleIdentifier.NORMAL);
        builder.insertParagraph();

        builder.insertTableOfContents( "\\o \"1-3\" \\h \\z \\u");
        builder.insertParagraph();

        int imageCount = 0;

        for ( int i = 0; i < recordsCount; ++i)
        {
            if ( i % 200 == 0)
            {
                System.out.println( "Written " + i + " records …" );

                builder.getParagraphFormat().setStyleIdentifier( StyleIdentifier.HEADING\_1);
                builder.writeln( "Heading " + i);
            }
            else
            {
                builder.getParagraphFormat().setStyleIdentifier( StyleIdentifier.NORMAL);
                builder.writeln( "Paragraph " + i);

            }

            builder.getParagraphFormat().setStyleIdentifier( StyleIdentifier.NORMAL);
            builder.writeln( LONG\_TEXT);

            if ( i % 50 == 0)
            {
                String imagePath = this.getClass().getResource( "jazz.jpg").toExternalForm();
                Shape shape = builder.insertImage(imagePath);
                shape.setBounds( IMAGE\_BOUNDS);
                builder.insertParagraph();
                ++imageCount;

                imagePath = this.getClass().getResource( "rose.png").toExternalForm();
                shape = builder.insertImage(imagePath);
                shape.setBounds( IMAGE\_BOUNDS);
                builder.insertParagraph();
                ++imageCount;
            }

            builder.getParagraphFormat().setStyleIdentifier( StyleIdentifier.NORMAL);
            builder.writeln( LONG\_TEXT);

            builder.insertParagraph();
        }

        System.out.println( "Image count: " + imageCount);

        String unique = UUID.randomUUID().toString().replaceAll( " ", "*");
        String pdfpath = baseFolder + "test*" + unique + ".pdf";
        // String docxpath = baseFolder + "test\_" + unique + ".docx";

        System.out.println( ">>> Updating fields …");
        doc.updateFields();

        // System.out.println( ">>> Writing " + docxpath + " …");
        // doc.save(docxpath);

        System.out.println( ">>> Writing " + pdfpath + " …");
        doc.save( pdfpath);

        System.out.println( "Done");
    } 

    @Test
    public void testScalability() throws Exception
    {
        long t1 = System.currentTimeMillis();
        setupLicense();
        writeDocument( 5000, System.getProperty("java.io.tmpdir"));
        long t2 = System.currentTimeMillis();
        System.out.println("Time cost is: " + (t2 - t1)/1000 + " seconds.");
    }
}

For Word output, the performance downgrade almost triple as PDF output.

Best regards.

Hi,

Thanks for your inquiry.

While using the latest version of Aspose.Words for Java i.e. 11.0.0, I was unable to reproduce this performance issue on my side. For me, the average execution time of writeDocument function for three test runs was 7.66 seconds. You should also note that in your code you’re calculating the elapsed time for two functions i.e. setupLicense & writeDocument. Please correct your code and let us know your findings then. Moreover, could you please attach “jazz.jpg” and “rose.png” images here. I will investigate the issue further and provide you more information.

Best Regards,

Hi Awais,

I don’t think setupLicense method will affect the test result. After move the setupLicense out from time mesure, and I did the tests again. I get the result as:

Aspose 11, Word: 155 seonds
Aspose 11, PDF: 139 seconds

Aspose 10.5, Word: 48 seconds
Aspose 10.5, PDF: 64 seconds

The result is the same. Here I give my machine spec:

CPU: Intel® Core i5 @ 2.53GHz
Mem: 3GB

Run JVM with Maximum Heap Size 1024M

So, please focus on the comparison test between Aspose 11 and Aspose 10.5 to see what time it took to create Word and PDF documents.

At last, I attached two image files here for your reference.

Thanks & regards.
Vincent

Image files are attached.

Hi,

using Vincent’s test, replacing the PDF with Word and increasing the record size to 10000 from 5000 and removing all images requires 218 seconds on an I7 quad core, 4GB RAM, 64 bit OS machine. Same test with Aspose 10.05 finished in 8 seconds.

Further increasing the limit to 15000 takes 12 seconds. With Aspose 11.00 the same takes 614 seconds.

On slower machines ( i3, i5m dual cores etc) the performance decrease is even larger, in some cases going more than 30 minutes with Aspose 11.00 from a couple of seconds with Aspose 10.05.

Code attached.

This is a showstopper for us.

Regards,
Dragos

Hi Vincent,

Thanks for the additional information. Unfortunately, I was still unable to reproduce this issue on my side. The generation of PDF took even lesser time (6 seconds) on my side. I have attached PDF file i.e. generated on my side here for your reference. Please check the size of PDF which is only 562 kb. Moreover, I tested with JDK v1.7 on 64-bit Windows 7. Could you please tell us about your JDK version and OS? We’ll investigate the issue further and provide you more information.

Best Regards,

Please use OS Windows XP Service Pack 3 and JDK 1.5 to redo the above. Aslo you need to do the same tests with Aspose 10.5 on the same machine to see what time it need to write out Word and PDF?

Thanks & regards.
Vincent

Changed the code from:

writeDocument( 5000, System.getProperty("java.io.tmpdir"));

to:

writeDocument( 12000, System.getProperty("java.io.tmpdir"));

I did larger file tests, and the created Word document size is 90M with 3962 pages. The performance downgrade more significantly:

Aspose 10.5:
PDF 326 seconds
Word 177 seconds

Aspose 11, the time increased significantly:
PDF 899 seconds
Word 1268 seconds

As the document size increase, the performance downgrade much significantly.

Please verify the above test in your environment. It is very critical for our PRE release to customers.

Thanks & regards.

Hi Vincent,

Thanks for the additional information. We’re working over your query and will get back to you soon.

Best Regards,

Hi,

It is to update you that I managed to reproduce this performance issue on my side. I have logged this issue in our bug tracking system. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. We apologize for your inconvenience.

Best Regards,

Hi Dragos,

Can you confirm this issue only happens with Windows XP SP3? If so can I ask why this is your requirement, is it a baseline you use for customers?

From Support Team’s comments it seems they can only reproduce this on XP (and so have logged it as a specific issue relating to XP) so I just want to clarify this point to ensure we target the right problem for you.

Best Regards,

Billy.

Hey Billy,

my tests were made on Windows 7 Professional 64 bit. But other colleagues tested on Windows XP SP3.

Regards,
Dragos

Hi Dragos,

Thanks for the additional information. Could you please tell us about the JDK version i.e. installed on your machine? Rest assured, we will keep you informed regarding the status of this issue and let you know via this forum thread once this issue is resolved.

Best Regards,

Hi Dragos,

I just sent the hotfix to Donald. This jar is 12% faster than 10.5 on my environment. Please inform me how it works for you. And please note that if you want linear scalability for 10k+ records you have to increase your JVM heap size.

Regards,

Hi Dragos,

I just resent to you only jars from hotfix by direct emails. Please check your mail and junk mail boxes. Please inform me asap how it work for you.

Regards,

Hey Konstantin,

this build shows an improvement compared to Aspose 11.0 but it’s no way near Aspose 10.05 so it’s not fixing the issue for us.

Also note that API breaks the API as FontSettings.getFontsFolders() method no longer exists.

Here are my test results:

Test machines specification
· CPU: Intel® Core i7 @ 1.60GHz
· RAM: 4GB
· OS: Windows 7 Professional 64 bit
· IBM JDK 5.0

o Java™ 2 Runtime Environment, Standard Edition (build pwi32devifx-20100511b (S
o R11 FP2 ))
o IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows 7 x86-32 j9vmwi3223ifx-20100
o 511 (JIT enabled)
o J9VM - 20100509_57823_lHdSMr
o JIT - 20091016_1845ifx7_r8
o GC - 20091026_AA)
o JCL - 20100511a

· Java memory settings: -Xms700m -Xmx1400m

Test Results

1000 test entries, file size 2067KB, 305 pages

  • 10.05 - 1 second
  • 11.0 - 2 seconds (200%)
  • 11.1 - 1 second

2500 test entries, file size 5155KB, 762 pages

  • 10.05 - 2 seconds
  • 11.0 - 10 seconds (500%)
  • 11.1 - 8 seconds

5000 test entries, file size 10302KB, 1523 pages

  • 10.05 - 4 seconds
  • 11.0 - 34 seconds (850%)
  • 11.1 - 25 seconds

10000 test entries, file size 20596KB, 3046 pages

  • 10.05 - 9 seconds
  • 11.0 - 206 seconds (2244%)
  • 11.1 - 101 seconds

15000 test entries, file size 30901KB, 4569 pages

  • 10.05 - 13 seconds
  • 11.0 - 631 seconds (4853%)
  • 11.1 - 366 seconds

Regards,
Dragos

Hi Dragos,

You have tested 11.1 or 11.1.1 (that I sent)?

And how about heap size? I noticed that non-linear scalability (like 1 – 8 – 25) disappears if I rise heap size.

It’s too late in my timezone, I will answer in detail tomorrow.

In my last tests I removed images since them clog up my profiler, may be this lowered desired heap size…

And can you disable JIT for tests?

Regards,

Hi Konstantin,

I had a Conf. Call with Dragos and Donald from IBM just there to better understand their immediate priorities for this fix better.

I can separate two points out which are important to them;

  1. They have tested their internal release (i.e. all internal regression tests, UAT tests) with Aspose 11.0. From that build the only issue they have in performance, if in 11.1 and 11.1.1 we add in other fixes other than the performance it means they cannot use it since it’s impossible to repeat all the other production tests in time for their next release. Is is possible for us to isolate your improvements and provide a hotfix just with those performance optimisations but otherwise identical to 11.0?
  2. I’ll let Dragos answer the point about heap size; basically they need it to be optimized so we get it as close as possible to the performance of the previous version before their release. Hopefully there is still some work can be done here.

I established with them that the latest date we can provide a release to them in time to give them time to do internal testing processes to make the next Product release would be 12th of March.

I have explained we will do our best to help them under Enterprise Support, but obviously cannot guarantee anything specific for that date. Can you update this thread on what level of improvement you believe may be possible by that time which can help IBM plan early.

Thanks for your hard work on this issue so far. I’ve also copied this comment to JIRA for reference.

Hi Billy, Dragos and Donald,

  1. I think yes, I can extract performance fixes and add them to 11.0. And this can be done till 12th of March.

  2. About performance of the previous version, heap size, JIT optimization, etc. – it’s still not clear for me. Is it performance of 11.1.1 is good enough? Today all the day I launched the test in different combinations of AW (10.1, 10.5, 11.1.1), AW jars (jdk1.5 and jdk1.6) and JRE (1.5 and 1.6). And I can reproduce performance of 10.5 reported by Dragos. My 11.1.1 performs better than 10.5 in any of my environments.

Here are few of my tables:

AW 10.5 AW 11.1.1
jdk1.5with sections jdk1.6 w sections jdk1.5 w/o sections jdk1.5with sections jdk1.6 w sections jdk1.5 w/o sections
1000 records, doc 9 9 9 5 5 7
2500 records, doc 20 17 20 13 12 18
5000 records, doc 38 31 38 24 24 44
10000 records, doc 78 65 77 50 49 127
15000 records, doc 111 227 139 124 226 1186

As you can see my best results for AW 10.5 (9-20-38-78-111) are very far from Dragos AW 10.5 (1-2-4-9-13). I even tried AW 10.1:) but it very close to 10.5.

Another thing i confirmed from myself is scalability of AW: the scalability is linear, but till some memory limit. After this limit (depends on jre and code options) jvm launches swapping and we get non-liniear scalability (highlihted by yellow in the table).

My environment is:

Core2Duo 3.1Ghz, 8Gb RAM, Windows 7 Proffesional 64-bit, 32-bit JRE (Oracle jdk1.5.0_22 or 1.6.0_20), JIT disabled. -Xmx1556M.

Regards,