Document constructor is slow on the first call

i try it in 20.12,it is also very slow.my code:

   public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        long begin = System.currentTimeMillis();
        try {
            Document doc = new Document();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            System.out.println(i + "  use :" + (System.currentTimeMillis() - begin));
        }
    }
}

out:

0 use :1314
1 use :5
2 use :4
3 use :4
4 use :5
5 use :4
6 use :3
7 use :3
8 use :3
9 use :3

@awais.hafeez

@haochun On the first call Aspose.Words inits static resources, which are reused on the next calls. I have tested your code on my side with the latest 21.12 version of Aspose.Words and the result is much better than yours:

0  use :208
1  use :6
2  use :4
3  use :5
4  use :4
5  use :3
6  use :3
7  use :3
8  use :3
9  use :3

ok,I will try it in new version.I want to use it in serverless,so I want init as quick as more.it is any time to fast?

i have try the 21.12 version.it it also slow.my computer is macbook pro.

2 GHz 4 cores Intel Core i5
16 GB 3733 MHz LPDDR4X

@haochun I will configure environment on mac, test your scenario and provide you more information.

@haochun I have tested the scenario once again and it seems you are using Aspose.Words in Evaluation mode. This gives a difference in the first run init time. For example on my PC I get the following results when run Aspose.Words in evaluation mode:

0  use :610
1  use :3
2  use :3
3  use :3
4  use :3
5  use :2
6  use :2
7  use :2
8  use :2
9  use :2

and the following results when run in licensed mode:

0  use :106
1  use :3
2  use :2
3  use :2
4  use :2
5  use :2
6  use :2
7  use :1
8  use :2
9  use :2

To test Aspose.Words without evaluation version limitations, you can request a temporary 30 days license.