Xtext performance Issue on serialization [message #1712632] |
Tue, 27 October 2015 01:45 |
john FG Messages: 1 Registered: October 2015 |
Junior Member |
|
|
Hi all,
We are currently facing a performance issue when serializing a large model in our project, and we want to know whether we are doing things wrong on our side or it's a limitation of xtext.
To demonstrate this performance issue, we have created these basic test projects which are available in github (https://github.com/johnf-repo/xtext):
And here's some figures
org.johnf.mydsl1 - Xtext project without user defined scope
- Loading an empty model, when adding 4000 entities with no fields, the serialization Took 488ms
- Loading an empty model, when adding 1000 entities with 3 fields each, the serialization Took 5,551ms. Field has a cross reference object DataType.
- Loading a model with 1000 entities with 3 fields each, and without making any modifications, the serialization Took 1,724ms
org.johnf.mydsl2 - Xtext project with user defined scope on field_type
- Loading an empty model, when adding 4000 entities with no fields, the serialization Took 496ms
- Loading an empty model, when adding 1000 entities with 3 fields each, the serialization Took 11,569ms
- Loading a model with 1000 entities with 3 fields each, and without making any modifications, the serialization Took 2,301ms
So I am bit lost and try to understand
a) why it took longer to serialize objects with cross references than objects without, note the difference is quite big (refer to org.johnf.mydsl1 project, 5,551ms for adding 1000 entities with 3 fields each compared to only 488ms for adding 4000 entitities without fields)
b) why the serialization took less time when serializing large model without modifications, even if it contains cross references object (refer to org.johnf.mydsl1 project, 1,724ms only for serializing an existing model with 1000 entities with 3 fields each)
c) In project org.johnf.mydsl2, we add a custom scope scope_field_type (refer to the file MyDslScopeProvider) and this makes the serialization time a lot worse, Perhaps i am doing the scoping wrong, could someone help me on this too please?
Any tips and helps are welcome.
Thanks,
John
|
|
|
Re: Xtext performance Issue on serialization [message #1712705 is a reply to message #1712632] |
Tue, 27 October 2015 14:51 |
|
Hi John,
a) When serializing crossrefs, the scope provider is asked for the name of the object, which takes time.
b) For newly created objects, the serializer needs to compute the corresponding text. When serializing existing objects, it can use the existing text from the nodemodel.
You can profile the serializer to see where it is spending most of the time and then optimize those parts.
c) Attach a profiler and you will see what the expensive part of your scope provider is
Cheers,
Stefan
|
|
|
Powered by
FUDForum. Page generated in 0.02474 seconds