Faster load times – OMG!

With two lines of code I think I’ve improved Archi model load times by about 4000%.

Some users had been complaining of very long load times of several minutes but I’d always assumed that the slow load speed was due to EMF taking its sweet time to load a monolithic XML file, and had resigned myself to the notion that this doesn’t scale with large models. I was then planning on making deep changes to the persistence format to save and load multiple XML files and load them on demand.

Then, while testing the new repository plugin using JB’s “grafico” format, we noticed that large models loaded very quickly. The grafico format uses multiple XML files for each object. I started to think…

So I Googled “EMF slow load” and found this:

https://www.eclipse.org/forums/index.php/t/796300/

Ding!

So I added:

resource.getDefaultLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
resource.setIntrinsicIDToEObjectMap(new HashMap());

and made some adjustments elsewhere and bingo!

Now, the thing is, I want to know that if storing the IDs in a separate HashMap has any side effects. So far I don’t think it has, because the Resource is discarded once the model is loaded.

User feedback is encouraging – 17 minutes reduced to 13 seconds.

OMG!

Code Punk | Muso | Archi Guy | Not a Thought Leader
Posts created 77

Begin typing your search term above and press enter to search. Press ESC to cancel.