SlideShare ist ein Scribd-Unternehmen logo
1 von 130
Downloaden Sie, um offline zu lesen
Xtext beyond the defaults
How to tackle performance problems
Who is that guy?
Xtext defaults are a good start!
But one size does not fit all!
Xtext defaults are a good start!
But one size does not fit all!
Amount of DSLs increases
Xtext defaults are a good start!
But one size does not fit all!
Amount of DSLs increases
Files get bigger
Xtext defaults are a good start!
But one size does not fit all!
Amount of DSLs increases
Files get bigger
Amount of files increases
Xtext defaults are a good start!
But one size does not fit all!
Amount of DSLs increases
Files get bigger
Amount of files increases
Many cross references
Xtext defaults are a good start!
But one size does not fit all!
Amount of DSLs increases
Files get bigger
Amount of files increases
Many cross references
Maybe transitive cross references…
Look what we have build!
Look what we have build!
More than 20 DSLs…
Look what we have build!
More than 20 DSLs…
and 200.000 lines in one file…
Look what we have build!
More than 20 DSLs…
and 200.000 lines in one file…
and we can check in broken models…
Look what we have build!
More than 20 DSLs…
and 200.000 lines in one file…
and we can check in broken models…
and we generate the missing stuff…
Look what we have build!
More than 20 DSLs…
and 200.000 lines in one file…
and we can check in broken models…
and we generate the missing stuff…
to make them valid again!
Look what we have build!
More than 20 DSLs…
and 200.000 lines in one file…
We are on Xtext 2.6.2 and can’t update!
and we can check in broken models…
and we generate the missing stuff…
to make them valid again!
Look what we have build!
More than 20 DSLs…
and 200.000 lines in one file…
We are on Xtext 2.6.2 and can’t update!
and we can check in broken models…
and we generate the missing stuff…
to make them valid again!
Could you please back-port the changes?
Everything is sooo slow!!!
Xtext sucks!!!
Finally think about improving the situation!
Update to newest Xtext Version
2.10.x
Update to newest Xtext Version
2.10.x
Xtext 2.11
released
early
2017
Why should I update???
Because…we killed bugs…
Because…we killed bugs…
Let workarounds
not last forever!
…Speed…
…Speed…
Resolving
cross-
references
has
never
been
faster…
…new features…
…new features…
Make
Xtext work
with
other
platform
s
…let’s work together.
…let’s work together.
It was
never
easier
to
contribute!
We
are
on
G
ithub
:-D
What about Performance…
Most problems happen in…
…Index and scoping…
…Memory consumption.
Validations…
… Complex generators…
I need Xbase in every language…
I need Xbase in every language…
… because my language is
complicated…
I need Xbase in every language…
… because my language is
complicated…
… no I can’t explain why…
I need Xbase in every language…
… because my language is
complicated…
… no I can’t explain why…
… but there is this small corner case…
Is a FAST validation really fast…
Is a FAST validation really fast…
… it’s triggered every time I stop typing
Scoping is sooo complicated…
Scoping is sooo complicated…
… I heard that in nearly every project…
Scoping is sooo complicated…
… I heard that in nearly every project…
…and people stop improving things when
it work’s for the first time…
Scoping is sooo complicated…
… I heard that in nearly every project…
…and people stop improving things when
it work’s for the first time…
… code is not touched any more because
who knows…
Scoping is sooo complicated…
… I heard that in nearly every project…
…and people stop improving things when
it work’s for the first time…
… code is not touched any more because
who knows…
… it worked before you touched it!
What’s the problem?
LocalScope
GlobalScope
ImportScopeTypeScope
Caches everywhere
The Index
Lazylinking
EcoreUtils.resolveAll should do the trick!
DerivedState
ContainerState
BatchLinkableResource
Scoping API
scope_Element_feature(Element element ,EReference ref)
Scoping API
scope_Element_feature(Element element ,EReference ref)
Scoping API
scope_Element_feature(Element element ,EReference ref)
Scoping API
scope_Element_feature(Element element ,EReference ref)
Scoping API
scope_Element_feature(Element element ,EReference ref)
Called by the PolymorphicDispatcher…
Scoping API
scope_Element_feature(Element element ,EReference ref)
Called by the PolymorphicDispatcher…
…in a reflective way…
Scoping API
scope_Element_feature(Element element ,EReference ref)
Called by the PolymorphicDispatcher…
and if grammar changed it might not get called any more…
…in a reflective way…
Scoping API
scope_Element_feature(Element element ,EReference ref)
Called by the PolymorphicDispatcher…
and if grammar changed it might not get called any more…
…in a reflective way…
…BECAUSE IT’S SLOW!
Scoping API
scope_Element_feature(Element element ,EReference ref)
Called by the PolymorphicDispatcher…
and if grammar changed it might not get called any more…
…in a reflective way…
…BECAUSE IT’S SLOW!
Implement
getScope(EObject context, EReference ref)
if(context instanceof Element && ref ==
MyPackage.Literals.ELEMENT_FEATURE)
up to 10 %
Scoping API
scope_Element_feature(Element element ,EReference ref)
Called by the PolymorphicDispatcher…
and if grammar changed it might not get called any more…
…in a reflective way…
…BECAUSE IT’S SLOW!
Implement
getScope(EObject context, EReference ref)
if(context instanceof Element && ref ==
MyPackage.Literals.ELEMENT_FEATURE)
up to 10 %Will not work
with
Xbase
anyway…
Use caches in the ScopeProvider
Use caches in the ScopeProvider
For each cross reference the ScopeProvider gets asked…
Use caches in the ScopeProvider
…and it calculates the very same stuff
over and over again…
For each cross reference the ScopeProvider gets asked…
Use caches in the ScopeProvider
…and it calculates the very same stuff
over and over again…
For each cross reference the ScopeProvider gets asked…
…cache the calculated stuff and invalidate it when
necessary!
Use caches in the ScopeProvider
…and it calculates the very same stuff
over and over again…
For each cross reference the ScopeProvider gets asked…
…cache the calculated stuff and invalidate it when
necessary!
The cache of the GlobalScope should be the index and
nothing else!
Use the force of the Index
Use the force of the Index
Holds all lightweight representations of
referenceable elements and their resources
Use the force of the Index
Holds all lightweight representations of
referenceable elements and their resources
It’s a HashMap…
It’s super fast since Xtext 2.x
and improved further
Holds all lightweight representations of
referenceable elements and their resources
Use the force of the Index
It’s a HashMap…
It’s super fast since Xtext 2.x
and improved further
It’s YOUR Index - you can put data in…!
Index - how to feed it
Index - how to feed it
1. Builder picks up DSL files and loads them one by one
Index - how to feed it
1. Builder picks up DSL files and loads them one by one
2. Creates ResourceDescriptions through ResourceDescriptionManager
Index - how to feed it
1. Builder picks up DSL files and loads them one by one
2. Creates ResourceDescriptions through ResourceDescriptionManager
3. ResourceDescriptionManager calls ResourceDescriptionsStrategy to
create EObjectDescriptions
Index - how to feed it
1. Builder picks up DSL files and loads them one by one
2. Creates ResourceDescriptions through ResourceDescriptionManager
3. ResourceDescriptionManager calls ResourceDescriptionsStrategy to
create EObjectDescriptions
You have to bind a custom impl for the ResourceDescriptionsStrategy in
the RuntimeModule
Index - how to feed it
1. Builder picks up DSL files and loads them one by one
2. Creates ResourceDescriptions through ResourceDescriptionManager
3. ResourceDescriptionManager calls ResourceDescriptionsStrategy to
create EObjectDescriptions
You have to bind a custom impl for the ResourceDescriptionsStrategy in
the RuntimeModule
The default creates a EObjectDescription for
EVERY Element that has a name…
IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData)
Information hiding and userData
IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData)
Information hiding and userData
IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData)
Information hiding and userData
IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData)
Information hiding and userData
Save memory & time
UserData - what for?
UserData - what for?
Validation
Don’t load the world to get informations - put
them in the index
UserData - what for?
Validation
Don’t load the world to get informations - put
them in the index
Scoping
Don’t resolve proxies for simple informations
Reference non Xtext models
Reference non Xtext models
We have our own GlobalScopeProvider that does the trick…
Reference non Xtext models
We have our own GlobalScopeProvider that does the trick…
…we load everything and the GlobalScope contains the
corresponding EObjectDescriptions…
Reference non Xtext models
We have our own GlobalScopeProvider that does the trick…
…we load everything and the GlobalScope contains the
corresponding EObjectDescriptions…
…but it’s slow and we cannot navigate those elements in the
editor…
You can do better…
Reuse the Xtext infrastructure
Reuse the Xtext infrastructure
Bind a ResourceServiceProvider…
…so that you can put the elements in the index and make
them navigable!
Reuse the Xtext infrastructure
Bind a ResourceServiceProvider…
…so that you can put the elements in the index and make
them navigable!
GenericResourceServiceProvider
Use
It will put everything that has a name in the index…
… introduce your own ResourceDescriptionStrategy!
But the builder picks them up…
and it takes ages!
Put the index in the jar
Put the index in the jar
Why calculating the index of a static set of files?
Put the index in the jar
The index is serialisable…
…put it in the jar and load it.
Why calculating the index of a static set of files?
Index in Standalone
It’s sooo slow…
Index in Standalone
It’s sooo slow…
…of course I have my custom Standalone impl…
Index in Standalone
ResourceSetGlobalScopeProvider
Long time the
was the default.
Index in Standalone
ResourceSetGlobalScopeProvider
Long time the
was the default.
Today we can do better but you need to use it and know that
there is something new…
For Maven- and Gradleplugin it’s done.
Index in Standalone
Fill the index and install it on the ResourceSet!
Load each resource and ask the ResourceDescriptionManager
to create a ResourceDescription…
Index in Standalone
Fill the index and install it on the ResourceSet!
Load each resource and ask the ResourceDescriptionManager
to create a ResourceDescription…
Install it on the ResourceSet
Make big things run again and save your ass!
Up to 80% more faster in 10 minutes!
Codegenerators
They are sooo slow…
Codegenerators
They are sooo slow…
… of course I am using mwe2 to invoke it…
Codegenerators
They are sooo slow…
… of course I am using mwe2 to invoke it…
… even in the IDE!
Incremental generators
Incremental generators
The builder triggers the generator for each resource…
Incremental generators
The builder triggers the generator for each resource…
…when a file changes the builder computes the impact and
retriggers the generator for each affected file!
Incremental generators
The builder triggers the generator for each resource…
…when a file changes the builder computes the impact and
retriggers the generator for each affected file!
What about m:n scenarios?
Solveable with a little effort - but it is worth the work!
Incremental generators
The builder triggers the generator for each resource…
…when a file changes the builder computes the impact and
retriggers the generator for each affected file!
What about m:n scenarios?
Solveable with a little effort - but it is worth the work!
There is a ParallelBuilderParticipant…
…you have to bind it for your language…
… make sure all proxies are already resolved!
Memory consumption
Memory consumption
DisabledClusteringPolicy
Do not unload resource…
Memory consumption
DisabledClusteringPolicy
DynamicResourceClusteringPolicy
Do not unload resource…
Unload resources when there is no free memory…
…can be configured.
The NodeModel is huge
Stores the syntax tree with text and positions…
The NodeModel is huge
Stores the syntax tree with text and positions…
…is used to get the position of a specific element or
feature…
The NodeModel is huge
Stores the syntax tree with text and positions…
…is used to get the position of a specific element or
feature…
…produces a lot of Strings in memory…
The NodeModel is huge
Stores the syntax tree with text and positions…
…is used to get the position of a specific element or
feature…
…produces a lot of Strings in memory…
…and during the builder runs you do not really need
it.
Switch off the NodeModel
Switch off the NodeModel
The parser creates it …
Switch off the NodeModel
The parser creates it …
…it is used to install proxies - so you have to do that
differently…
Switch off the NodeModel
The parser creates it …
…it is used to install proxies - so you have to do that
differently…
You want to have it when the editor is used…
Switch off the NodeModel
The parser creates it …
…it is used to install proxies - so you have to do that
differently…
You want to have it when the editor is used…
… the load options should be an indicator…
Switch off the NodeModel
The parser creates it …
…it is used to install proxies - so you have to do that
differently…
You want to have it when the editor is used…
… the load options should be an indicator…
…what are the implications?
Implications
You cannot use the NodeModel in validations and
scoping any more…
Implications
You cannot use the NodeModel in validations and
scoping any more…
…Issues are marked at position 0,0…
…an EditorCallback should revalidate the content.
Implications
You cannot use the NodeModel in validations and
scoping any more…
…Issues are marked at position 0,0…
…an EditorCallback should revalidate the content.
THIS IS NOT A COMMON THING!
DO IT ONLY WHEN IT IS REALLY NECESSARY!
Order makes a difference
Order makes a difference
Files might belong together…
Order makes a difference
Files might belong together…
…and might reference each other.
Order makes a difference
Files might belong together…
…and might reference each other.
Putting them in an logical order for the builder…
Order makes a difference
Files might belong together…
…and might reference each other.
Putting them in an logical order for the builder…
… and they do not have be loaded more than once.
Order makes a difference
Files might belong together…
…and might reference each other.
Putting them in an logical order for the builder…
… and they do not have be loaded more than once.
Sometimes it makes sense to not unload them at all.
Now you know!
Professional Support
Xtext beyond the defaults -  how to tackle performance problems

Weitere ähnliche Inhalte

Was ist angesagt?

Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
Staples
 

Was ist angesagt? (20)

JPA For Beginner's
JPA For Beginner'sJPA For Beginner's
JPA For Beginner's
 
TypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptxTypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptx
 
JavaScript Execution Context
JavaScript Execution ContextJavaScript Execution Context
JavaScript Execution Context
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
 
ZIO-Direct - Functional Scala 2022
ZIO-Direct - Functional Scala 2022ZIO-Direct - Functional Scala 2022
ZIO-Direct - Functional Scala 2022
 
Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
 
Jetpack Compose a new way to implement UI on Android
Jetpack Compose a new way to implement UI on AndroidJetpack Compose a new way to implement UI on Android
Jetpack Compose a new way to implement UI on Android
 
Introduction to java 8 stream api
Introduction to java 8 stream apiIntroduction to java 8 stream api
Introduction to java 8 stream api
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
 
C++ Standard Template Library
C++ Standard Template LibraryC++ Standard Template Library
C++ Standard Template Library
 
Extending the Xbase Typesystem
Extending the Xbase TypesystemExtending the Xbase Typesystem
Extending the Xbase Typesystem
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIO
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Css Display Property
Css Display PropertyCss Display Property
Css Display Property
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
Jetpack Compose a nova forma de implementar UI no Android
Jetpack Compose a nova forma de implementar UI no AndroidJetpack Compose a nova forma de implementar UI no Android
Jetpack Compose a nova forma de implementar UI no Android
 
Flutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdfFlutter State Management Using GetX.pdf
Flutter State Management Using GetX.pdf
 

Andere mochten auch

Eclipse DemoCamp in Paris: Language Development with Xtext
Eclipse DemoCamp in Paris: Language Development with XtextEclipse DemoCamp in Paris: Language Development with Xtext
Eclipse DemoCamp in Paris: Language Development with Xtext
Sebastian Zarnekow
 
ARText - Driving Developments with Xtext
ARText - Driving Developments with XtextARText - Driving Developments with Xtext
ARText - Driving Developments with Xtext
Sebastian Benz
 

Andere mochten auch (20)

From Stairway to Heaven onto the Highway to Hell with Xtext
From Stairway to Heaven onto the Highway to Hell with XtextFrom Stairway to Heaven onto the Highway to Hell with Xtext
From Stairway to Heaven onto the Highway to Hell with Xtext
 
Building Your Own DSL with Xtext
Building Your Own DSL with XtextBuilding Your Own DSL with Xtext
Building Your Own DSL with Xtext
 
Code Generation idioms with Xtend
Code Generation idioms with XtendCode Generation idioms with Xtend
Code Generation idioms with Xtend
 
Introduction to Xbase
Introduction to XbaseIntroduction to Xbase
Introduction to Xbase
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with Xtend
 
EMF - Beyond The Basics
EMF - Beyond The BasicsEMF - Beyond The Basics
EMF - Beyond The Basics
 
EMF Tips n Tricks
EMF Tips n TricksEMF Tips n Tricks
EMF Tips n Tricks
 
Xtend - A Language Made for Java Developers
Xtend - A Language Made for Java DevelopersXtend - A Language Made for Java Developers
Xtend - A Language Made for Java Developers
 
DSLs for Java Developers
DSLs for Java DevelopersDSLs for Java Developers
DSLs for Java Developers
 
Graphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramGraphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagram
 
Jazoon 2010 - Building DSLs with Eclipse
Jazoon 2010 - Building DSLs with EclipseJazoon 2010 - Building DSLs with Eclipse
Jazoon 2010 - Building DSLs with Eclipse
 
Graphical Views For Xtext
Graphical Views For XtextGraphical Views For Xtext
Graphical Views For Xtext
 
Eclipse DemoCamp in Paris: Language Development with Xtext
Eclipse DemoCamp in Paris: Language Development with XtextEclipse DemoCamp in Paris: Language Development with Xtext
Eclipse DemoCamp in Paris: Language Development with Xtext
 
Enhancing Xtext for General Purpose Languages
Enhancing Xtext for General Purpose LanguagesEnhancing Xtext for General Purpose Languages
Enhancing Xtext for General Purpose Languages
 
ARText - Driving Developments with Xtext
ARText - Driving Developments with XtextARText - Driving Developments with Xtext
ARText - Driving Developments with Xtext
 
Xtext, diagrams and ux
Xtext, diagrams and uxXtext, diagrams and ux
Xtext, diagrams and ux
 
What's Cooking in Xtext 2.0
What's Cooking in Xtext 2.0What's Cooking in Xtext 2.0
What's Cooking in Xtext 2.0
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With Xtext
 
Scoping Tips and Tricks
Scoping Tips and TricksScoping Tips and Tricks
Scoping Tips and Tricks
 
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
 

Ähnlich wie Xtext beyond the defaults - how to tackle performance problems

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Justin Smestad
 
Development workflow
Development workflowDevelopment workflow
Development workflow
Sigsiu.NET
 
Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)
Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)
Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)
Apigee | Google Cloud
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
BigBlueHat
 

Ähnlich wie Xtext beyond the defaults - how to tackle performance problems (20)

Language Server Protocol - Why the Hype?
Language Server Protocol - Why the Hype?Language Server Protocol - Why the Hype?
Language Server Protocol - Why the Hype?
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Streams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetupStreams of information - Chicago crystal language monthly meetup
Streams of information - Chicago crystal language monthly meetup
 
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
 
Write code that writes code!
Write code that writes code!Write code that writes code!
Write code that writes code!
 
Writing a REST Interconnection Library in Swift
Writing a REST Interconnection Library in SwiftWriting a REST Interconnection Library in Swift
Writing a REST Interconnection Library in Swift
 
Elasticsearch Basics
Elasticsearch BasicsElasticsearch Basics
Elasticsearch Basics
 
ElasticSearch - index server used as a document database
ElasticSearch - index server used as a document databaseElasticSearch - index server used as a document database
ElasticSearch - index server used as a document database
 
The State of Wicket
The State of WicketThe State of Wicket
The State of Wicket
 
Play framework
Play frameworkPlay framework
Play framework
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
 
Development workflow
Development workflowDevelopment workflow
Development workflow
 
GWT is Smarter Than You
GWT is Smarter Than YouGWT is Smarter Than You
GWT is Smarter Than You
 
Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)
Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)
Building a Mobile Data Platform with Cassandra - Apigee Under the Hood (Webcast)
 
How it's made - MyGet (CloudBurst)
How it's made - MyGet (CloudBurst)How it's made - MyGet (CloudBurst)
How it's made - MyGet (CloudBurst)
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
The Ember.js Framework - Everything You Need To Know
The Ember.js Framework - Everything You Need To KnowThe Ember.js Framework - Everything You Need To Know
The Ember.js Framework - Everything You Need To Know
 
AMD - Why, What and How
AMD - Why, What and HowAMD - Why, What and How
AMD - Why, What and How
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
 
Nuxeo Platform 6.0 - What's New - November 2014
Nuxeo Platform 6.0 - What's New - November 2014Nuxeo Platform 6.0 - What's New - November 2014
Nuxeo Platform 6.0 - What's New - November 2014
 

Kürzlich hochgeladen

Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 

Kürzlich hochgeladen (20)

Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 

Xtext beyond the defaults - how to tackle performance problems

  • 1. Xtext beyond the defaults How to tackle performance problems
  • 2. Who is that guy?
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Xtext defaults are a good start! But one size does not fit all!
  • 8. Xtext defaults are a good start! But one size does not fit all! Amount of DSLs increases
  • 9. Xtext defaults are a good start! But one size does not fit all! Amount of DSLs increases Files get bigger
  • 10. Xtext defaults are a good start! But one size does not fit all! Amount of DSLs increases Files get bigger Amount of files increases
  • 11. Xtext defaults are a good start! But one size does not fit all! Amount of DSLs increases Files get bigger Amount of files increases Many cross references
  • 12. Xtext defaults are a good start! But one size does not fit all! Amount of DSLs increases Files get bigger Amount of files increases Many cross references Maybe transitive cross references…
  • 13. Look what we have build!
  • 14. Look what we have build! More than 20 DSLs…
  • 15. Look what we have build! More than 20 DSLs… and 200.000 lines in one file…
  • 16. Look what we have build! More than 20 DSLs… and 200.000 lines in one file… and we can check in broken models…
  • 17. Look what we have build! More than 20 DSLs… and 200.000 lines in one file… and we can check in broken models… and we generate the missing stuff…
  • 18. Look what we have build! More than 20 DSLs… and 200.000 lines in one file… and we can check in broken models… and we generate the missing stuff… to make them valid again!
  • 19. Look what we have build! More than 20 DSLs… and 200.000 lines in one file… We are on Xtext 2.6.2 and can’t update! and we can check in broken models… and we generate the missing stuff… to make them valid again!
  • 20. Look what we have build! More than 20 DSLs… and 200.000 lines in one file… We are on Xtext 2.6.2 and can’t update! and we can check in broken models… and we generate the missing stuff… to make them valid again! Could you please back-port the changes?
  • 21. Everything is sooo slow!!! Xtext sucks!!!
  • 22. Finally think about improving the situation!
  • 23. Update to newest Xtext Version 2.10.x
  • 24. Update to newest Xtext Version 2.10.x Xtext 2.11 released early 2017
  • 25. Why should I update???
  • 27. Because…we killed bugs… Let workarounds not last forever!
  • 33. …let’s work together. It was never easier to contribute! We are on G ithub :-D
  • 35. Most problems happen in… …Index and scoping… …Memory consumption. Validations… … Complex generators…
  • 36. I need Xbase in every language…
  • 37. I need Xbase in every language… … because my language is complicated…
  • 38. I need Xbase in every language… … because my language is complicated… … no I can’t explain why…
  • 39. I need Xbase in every language… … because my language is complicated… … no I can’t explain why… … but there is this small corner case…
  • 40. Is a FAST validation really fast…
  • 41. Is a FAST validation really fast… … it’s triggered every time I stop typing
  • 42. Scoping is sooo complicated…
  • 43. Scoping is sooo complicated… … I heard that in nearly every project…
  • 44. Scoping is sooo complicated… … I heard that in nearly every project… …and people stop improving things when it work’s for the first time…
  • 45. Scoping is sooo complicated… … I heard that in nearly every project… …and people stop improving things when it work’s for the first time… … code is not touched any more because who knows…
  • 46. Scoping is sooo complicated… … I heard that in nearly every project… …and people stop improving things when it work’s for the first time… … code is not touched any more because who knows… … it worked before you touched it!
  • 47. What’s the problem? LocalScope GlobalScope ImportScopeTypeScope Caches everywhere The Index Lazylinking EcoreUtils.resolveAll should do the trick! DerivedState ContainerState BatchLinkableResource
  • 52. Scoping API scope_Element_feature(Element element ,EReference ref) Called by the PolymorphicDispatcher…
  • 53. Scoping API scope_Element_feature(Element element ,EReference ref) Called by the PolymorphicDispatcher… …in a reflective way…
  • 54. Scoping API scope_Element_feature(Element element ,EReference ref) Called by the PolymorphicDispatcher… and if grammar changed it might not get called any more… …in a reflective way…
  • 55. Scoping API scope_Element_feature(Element element ,EReference ref) Called by the PolymorphicDispatcher… and if grammar changed it might not get called any more… …in a reflective way… …BECAUSE IT’S SLOW!
  • 56. Scoping API scope_Element_feature(Element element ,EReference ref) Called by the PolymorphicDispatcher… and if grammar changed it might not get called any more… …in a reflective way… …BECAUSE IT’S SLOW! Implement getScope(EObject context, EReference ref) if(context instanceof Element && ref == MyPackage.Literals.ELEMENT_FEATURE) up to 10 %
  • 57. Scoping API scope_Element_feature(Element element ,EReference ref) Called by the PolymorphicDispatcher… and if grammar changed it might not get called any more… …in a reflective way… …BECAUSE IT’S SLOW! Implement getScope(EObject context, EReference ref) if(context instanceof Element && ref == MyPackage.Literals.ELEMENT_FEATURE) up to 10 %Will not work with Xbase anyway…
  • 58. Use caches in the ScopeProvider
  • 59. Use caches in the ScopeProvider For each cross reference the ScopeProvider gets asked…
  • 60. Use caches in the ScopeProvider …and it calculates the very same stuff over and over again… For each cross reference the ScopeProvider gets asked…
  • 61. Use caches in the ScopeProvider …and it calculates the very same stuff over and over again… For each cross reference the ScopeProvider gets asked… …cache the calculated stuff and invalidate it when necessary!
  • 62. Use caches in the ScopeProvider …and it calculates the very same stuff over and over again… For each cross reference the ScopeProvider gets asked… …cache the calculated stuff and invalidate it when necessary! The cache of the GlobalScope should be the index and nothing else!
  • 63. Use the force of the Index
  • 64. Use the force of the Index Holds all lightweight representations of referenceable elements and their resources
  • 65. Use the force of the Index Holds all lightweight representations of referenceable elements and their resources It’s a HashMap… It’s super fast since Xtext 2.x and improved further
  • 66. Holds all lightweight representations of referenceable elements and their resources Use the force of the Index It’s a HashMap… It’s super fast since Xtext 2.x and improved further It’s YOUR Index - you can put data in…!
  • 67. Index - how to feed it
  • 68. Index - how to feed it 1. Builder picks up DSL files and loads them one by one
  • 69. Index - how to feed it 1. Builder picks up DSL files and loads them one by one 2. Creates ResourceDescriptions through ResourceDescriptionManager
  • 70. Index - how to feed it 1. Builder picks up DSL files and loads them one by one 2. Creates ResourceDescriptions through ResourceDescriptionManager 3. ResourceDescriptionManager calls ResourceDescriptionsStrategy to create EObjectDescriptions
  • 71. Index - how to feed it 1. Builder picks up DSL files and loads them one by one 2. Creates ResourceDescriptions through ResourceDescriptionManager 3. ResourceDescriptionManager calls ResourceDescriptionsStrategy to create EObjectDescriptions You have to bind a custom impl for the ResourceDescriptionsStrategy in the RuntimeModule
  • 72. Index - how to feed it 1. Builder picks up DSL files and loads them one by one 2. Creates ResourceDescriptions through ResourceDescriptionManager 3. ResourceDescriptionManager calls ResourceDescriptionsStrategy to create EObjectDescriptions You have to bind a custom impl for the ResourceDescriptionsStrategy in the RuntimeModule The default creates a EObjectDescription for EVERY Element that has a name…
  • 73. IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData) Information hiding and userData
  • 74. IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData) Information hiding and userData
  • 75. IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData) Information hiding and userData
  • 76. IEObjectDescription create(String simpleName, EObject element, Map<String, String> userData) Information hiding and userData Save memory & time
  • 78. UserData - what for? Validation Don’t load the world to get informations - put them in the index
  • 79. UserData - what for? Validation Don’t load the world to get informations - put them in the index Scoping Don’t resolve proxies for simple informations
  • 81. Reference non Xtext models We have our own GlobalScopeProvider that does the trick…
  • 82. Reference non Xtext models We have our own GlobalScopeProvider that does the trick… …we load everything and the GlobalScope contains the corresponding EObjectDescriptions…
  • 83. Reference non Xtext models We have our own GlobalScopeProvider that does the trick… …we load everything and the GlobalScope contains the corresponding EObjectDescriptions… …but it’s slow and we cannot navigate those elements in the editor… You can do better…
  • 84. Reuse the Xtext infrastructure
  • 85. Reuse the Xtext infrastructure Bind a ResourceServiceProvider… …so that you can put the elements in the index and make them navigable!
  • 86. Reuse the Xtext infrastructure Bind a ResourceServiceProvider… …so that you can put the elements in the index and make them navigable! GenericResourceServiceProvider Use It will put everything that has a name in the index… … introduce your own ResourceDescriptionStrategy!
  • 87. But the builder picks them up… and it takes ages!
  • 88. Put the index in the jar
  • 89. Put the index in the jar Why calculating the index of a static set of files?
  • 90. Put the index in the jar The index is serialisable… …put it in the jar and load it. Why calculating the index of a static set of files?
  • 92. Index in Standalone It’s sooo slow… …of course I have my custom Standalone impl…
  • 94. Index in Standalone ResourceSetGlobalScopeProvider Long time the was the default. Today we can do better but you need to use it and know that there is something new… For Maven- and Gradleplugin it’s done.
  • 95. Index in Standalone Fill the index and install it on the ResourceSet! Load each resource and ask the ResourceDescriptionManager to create a ResourceDescription…
  • 96. Index in Standalone Fill the index and install it on the ResourceSet! Load each resource and ask the ResourceDescriptionManager to create a ResourceDescription… Install it on the ResourceSet
  • 97. Make big things run again and save your ass! Up to 80% more faster in 10 minutes!
  • 99. Codegenerators They are sooo slow… … of course I am using mwe2 to invoke it…
  • 100. Codegenerators They are sooo slow… … of course I am using mwe2 to invoke it… … even in the IDE!
  • 102. Incremental generators The builder triggers the generator for each resource…
  • 103. Incremental generators The builder triggers the generator for each resource… …when a file changes the builder computes the impact and retriggers the generator for each affected file!
  • 104. Incremental generators The builder triggers the generator for each resource… …when a file changes the builder computes the impact and retriggers the generator for each affected file! What about m:n scenarios? Solveable with a little effort - but it is worth the work!
  • 105. Incremental generators The builder triggers the generator for each resource… …when a file changes the builder computes the impact and retriggers the generator for each affected file! What about m:n scenarios? Solveable with a little effort - but it is worth the work! There is a ParallelBuilderParticipant… …you have to bind it for your language… … make sure all proxies are already resolved!
  • 108. Memory consumption DisabledClusteringPolicy DynamicResourceClusteringPolicy Do not unload resource… Unload resources when there is no free memory… …can be configured.
  • 109. The NodeModel is huge Stores the syntax tree with text and positions…
  • 110. The NodeModel is huge Stores the syntax tree with text and positions… …is used to get the position of a specific element or feature…
  • 111. The NodeModel is huge Stores the syntax tree with text and positions… …is used to get the position of a specific element or feature… …produces a lot of Strings in memory…
  • 112. The NodeModel is huge Stores the syntax tree with text and positions… …is used to get the position of a specific element or feature… …produces a lot of Strings in memory… …and during the builder runs you do not really need it.
  • 113. Switch off the NodeModel
  • 114. Switch off the NodeModel The parser creates it …
  • 115. Switch off the NodeModel The parser creates it … …it is used to install proxies - so you have to do that differently…
  • 116. Switch off the NodeModel The parser creates it … …it is used to install proxies - so you have to do that differently… You want to have it when the editor is used…
  • 117. Switch off the NodeModel The parser creates it … …it is used to install proxies - so you have to do that differently… You want to have it when the editor is used… … the load options should be an indicator…
  • 118. Switch off the NodeModel The parser creates it … …it is used to install proxies - so you have to do that differently… You want to have it when the editor is used… … the load options should be an indicator… …what are the implications?
  • 119. Implications You cannot use the NodeModel in validations and scoping any more…
  • 120. Implications You cannot use the NodeModel in validations and scoping any more… …Issues are marked at position 0,0… …an EditorCallback should revalidate the content.
  • 121. Implications You cannot use the NodeModel in validations and scoping any more… …Issues are marked at position 0,0… …an EditorCallback should revalidate the content. THIS IS NOT A COMMON THING! DO IT ONLY WHEN IT IS REALLY NECESSARY!
  • 122. Order makes a difference
  • 123. Order makes a difference Files might belong together…
  • 124. Order makes a difference Files might belong together… …and might reference each other.
  • 125. Order makes a difference Files might belong together… …and might reference each other. Putting them in an logical order for the builder…
  • 126. Order makes a difference Files might belong together… …and might reference each other. Putting them in an logical order for the builder… … and they do not have be loaded more than once.
  • 127. Order makes a difference Files might belong together… …and might reference each other. Putting them in an logical order for the builder… … and they do not have be loaded more than once. Sometimes it makes sense to not unload them at all.