-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of cross-document refs has an important impact on performance #19
Comments
I guess some logic in |
After a slightly deeper analysis: the calling code resolve the reference list value, and iterates over it, and the submethod docKindMany(EObject, EReference) will do that again, leading to |
What's even stranger is that not only
I'll propose a PR to clean this up. |
This should help mostly in presence of references with high cardinalities as it avoids an O(n*n) iteration when serialising them. Bug: #19 Signed-off-by: Pierre-Charles David <[email protected]>
This should help mostly in presence of references with high cardinalities as it avoids an O(n*n) iteration when serialising them. Bug: #19 Signed-off-by: Pierre-Charles David <[email protected]>
From a decent size model, which have no inter document cross ref but quite a few internal references.
EObjects: 3894
References with values: 3121
And using:
String json = JsonResourceImpl.toJson(r, Collections.EMPTY_MAP);
Serialization of my model takes 77606 ms (77 secs) which seems a lot compared to serialization/deserialization using BinaryResource which takes about 400ms.
After profiling in tracing mode, in my case it all comes down to :
org.eclipse.sirius.emfjson.utils.GsonEObjectSerializer.docKindMany(EObject, EReference)
and the following code which, I assume, try to detect whether there is a cross document reference to serialize:
brute force approach of commenting out this code (which should not be used in my case) lead to
which is 100 times faster, and give the exact same result.
The text was updated successfully, but these errors were encountered: