eclipse-sirius / sirius-emf-json

JSON-based EMF Resource implementation - part of Eclipse Sirius
https://eclipse.dev/sirius/sirius-web.html
Eclipse Public License 2.0
5 stars 10 forks source link

[43] Only call getPackageForURI on URI-like paths #45

Open pcdavid opened 2 weeks ago

pcdavid commented 2 weeks ago

This avoids creating thousands of PackageNotFoundError instances when resolving "normal" inter-document references which do not refer to EPackages via nsURIs.

PackageNotFoundError are much cheaper to create than the previously used PackageNotFoundException, but that's still a lot of garbage instances to create, add into the resource.getErrors() list and never use (or even clear).

In addition, in the context of Sirius Web, every instance will have its own duplicate string representation of the failed "package" URI because we get it from EObjectIDManager.getOrCreateId(EObject) which invokes UUID.toString() and allocates a new (identical) String each time.

Bug: https://github.com/eclipse-sirius/sirius-emf-json/issues/43 Signed-off-by: Pierre-Charles David pierre-charles.david@obeo.fr