AuthorComponentFactory initialization optimization

Post here questions and problems related to oXygen frameworks/document types.
Johann
Posts: 83
Joined: Wed Jun 17, 2015 12:46 pm

AuthorComponentFactory initialization optimization

Post by Johann » Thu May 09, 2019 2:48 pm

Hello,

The call of the method init of the AuthorComponentFactory class is sometimes quite long on some machines (40 seconds).

The framework we use is quite large but on most machines we get a correct time that does not exceed 15 seconds.

I am looking to see what optimizations could be made to improve the time taken by this method.

This method takes a ZIP as input. I imagine that one of the first steps is an unzipping that can be consumer.
Isn't it possible to initialize AuthorComponentFactory by directly specifying the unzipped folder to use?

Thanks for your help,

Johann

Radu
Posts: 6326
Joined: Fri Jul 09, 2004 5:18 pm

Re: AuthorComponentFactory initialization optimization

Post by Radu » Thu May 09, 2019 3:16 pm

Hi Johann,

Indeed the AuthorComponentFactory will unzip the entire framework in the folder: %APPDATA%\Roaming\com.oxygenxml.author.component if you are running on Windows.
For Mac and Linux the cache folders are listed here:
https://www.oxygenxml.com/doc/versions/ ... oting.html
Does the delay (even the 15 second delay you experience) occur every time? Because If the component already finds up to date content in the cache folder it should not try to unzip it again.
Indeed we could try to add an API method to give it directly the folder containing the frameworks. I will add an issue for this. But I cannot commit to a timeline for it, especially as we will release Oxygen 21.1 in 1-2 weeks and Oxygen 22 is due for the end of next year.
I will also add an issue to profile the unzip operation on our side, create a very large ZIP and profile the component using the JProfiler application to see where in the code it spends the most time, but possibly those end users who experience delays might have slower hard drives (non-SSD).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Johann
Posts: 83
Joined: Wed Jun 17, 2015 12:46 pm

Re: AuthorComponentFactory initialization optimization

Post by Johann » Fri May 10, 2019 10:18 am

Hello Radu,

You are right, it took one of the machines 56 seconds to initialize the AuthorComponentFactory the first time and 24 seconds the second time. This machine does not have a SSD. So do 24 seconds seem like a "normal" time for AuthorComponentFactory initialization to you?
How could this time be improved?

Thank you!

Johann

Radu
Posts: 6326
Joined: Fri Jul 09, 2004 5:18 pm

Re: AuthorComponentFactory initialization optimization

Post by Radu » Mon May 13, 2019 12:25 pm

Hi Johann,

I'm back at the office so I started making some tests on my side, I had a 45 MB zip containing the frameworks and added some logging like this:

Code: Select all

    long before = System.currentTimeMillis();
    AuthorComponentFactory.getInstance().init(getFrameworkURLs(),
        getOptionsZip(),
        new URL(getAuthorComponentCodeBase()), "ApplId", 
        getLicenseKey());
    long after = System.currentTimeMillis();
    System.err.println("TOOK " + (after - before));
On my side, the first call took 101 seconds and the second call took less than 2 seconds. So the first call unzipped the framework in the user's home and the second call just used the folder containing the unzipped archive after it checked that there were no changes.
Can you try to add the same logging information on your side, just to see if the second call is fast?
I will also try to look into our code which expands the zip file, see if I can make it faster.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Radu
Posts: 6326
Joined: Fri Jul 09, 2004 5:18 pm

Re: AuthorComponentFactory initialization optimization

Post by Radu » Mon May 13, 2019 2:26 pm

Hi,

I reduced my test frameworks zip to about 9000 files, first unzip still takes about 85 seconds. Making some changes in our code I can reduce the unzip time to about 75 seconds on my side (so about 10% off) but that's not very much. So I will add an issue to consider giving the framework folder as a parameter directly instead of the zip.
Also maybe you should look inside the zip you provide, are all those files you provide necessary?

But if the second time the component is initialized on the same computer it still takes very long to actually display it the problem might also be somewhere else.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply