XAML files take a long time to load

I have noticed that a 500K xaml file takes 4-5 seconds to load.
Usually that is not a problem, but in this case it does.

I have a process where it calls the workflow roughly 10,000 times. That means it takes the process roughly 45,000 second to load/compile the workflow. It seems that UIPath reloads/compiles the same file over and over and over again. Can we compile the xaml once so that it can access the compiled code faster then a load/compile of the xaml code?

And no I can’t move the code down to the previous workflow because there is 4 levels of data. So the data A can have 1-n instances of B where it can have 1-n instances of C and it can have 1-n instances of D.

Then ideally you should Create a Library component of it and that will be better.

Regarding the time to load , it is weird such a small file takes that kuch time but it may be due to the input arguments. Like, dictionary are heavy to be loaded and passing multiple dictionaries create this slowness at times but not sure about your case until we see the workflow.

Using a library has fixed this problem, using a library has changed the call to about 0.1 seconds to access the workflow. So 1000 seconds is better than 45000 seconds and that is acceptable.

So I created a 2nd library that contained common workflows that we use in an number of projects. So I modified the existing project and 1st library to use the 2nd library. And I got a worse result. It took 5 minutes to publish the project. It now takes 1.5 minutes to load the workflow/library. Now the performance is total shot.

Is there any way to fix this?
Otherwise libraries are useless.