KEMBAR78
Responsiveness | PDF
Jan Köhnlein
Improving
the 

Responsiveness
of Your
Xtext-based
IDE
Xtext
Master
DOJO
• If you cannot parallelize, make it cancelable
• CancelableUnitOfWork
• OutdatedStateManager#checkOutdated
• OperationCanceledManager transforms exceptions
Cancelation
• IXtextDocument#priorityReadOnly
• for fast UI services, e.g. content assist
• cancels current document readers
• executes action
• restarts model listeners
Priority
Read
Transactions
• 10yo bug finally fixed in Mars
• JobManager#isBlocking didn’t consider thread jobs
• Auto-build no longer blocks a save operation
BUG  
60964
• Store fully-resolved models to disk
• Node model, resolved x-refs, resolved types, index
data…
• Drastically reduces build times
• especially for Xbase languages
Storage
Aware
Resource
• ParallelBuilderParticipant
Parallel
Generation
WORKOUT
For Xtext
Kyus
• Don’t guess – measure!
• Use a profiler, not the system clock
• But don’t trust your measurements!
The
Profiling
Koan
• Check CancelIndicators and ProgressMonitors
frequently
• Avoid calculation in the UI thread
• Careful with ProgressMonitor progress reporting
• Use BackgroundOutlineTreeProvider
Mastering
the GUI
• Avoid backtracking
• Reduce lookahead by
• adding keywords, preferably as prefix
• adding syntactic predicates
• use first-token-set predicates in complicated
lookahead scenarios
Train
your
Grammar
• Keep an eye on algorithmic complexity
• Prefer index-based NamesAreUniqueValidator
• Avoid unnecessary loading of external resources
• Use CheckType.NORMAL
Validation
KUNG-FU
• Avoid using long chains of binary operations
• Explicitly state types when necessary
Xbase
Workout
• Avoid clustering – increase memory instead
• Use StorageAwareResource
• Reduce number of indexed elements
• Use parallel code generator
• Maven: Avoid composite update sites
Builder
Katas
THank
YOU

Responsiveness

  • 1.
  • 2.
  • 3.
    • If youcannot parallelize, make it cancelable • CancelableUnitOfWork • OutdatedStateManager#checkOutdated • OperationCanceledManager transforms exceptions Cancelation
  • 4.
    • IXtextDocument#priorityReadOnly • forfast UI services, e.g. content assist • cancels current document readers • executes action • restarts model listeners Priority Read Transactions
  • 5.
    • 10yo bugfinally fixed in Mars • JobManager#isBlocking didn’t consider thread jobs • Auto-build no longer blocks a save operation BUG   60964
  • 6.
    • Store fully-resolvedmodels to disk • Node model, resolved x-refs, resolved types, index data… • Drastically reduces build times • especially for Xbase languages Storage Aware Resource
  • 7.
  • 8.
  • 9.
    • Don’t guess– measure! • Use a profiler, not the system clock • But don’t trust your measurements! The Profiling Koan
  • 10.
    • Check CancelIndicatorsand ProgressMonitors frequently • Avoid calculation in the UI thread • Careful with ProgressMonitor progress reporting • Use BackgroundOutlineTreeProvider Mastering the GUI
  • 11.
    • Avoid backtracking •Reduce lookahead by • adding keywords, preferably as prefix • adding syntactic predicates • use first-token-set predicates in complicated lookahead scenarios Train your Grammar
  • 12.
    • Keep aneye on algorithmic complexity • Prefer index-based NamesAreUniqueValidator • Avoid unnecessary loading of external resources • Use CheckType.NORMAL Validation KUNG-FU
  • 13.
    • Avoid usinglong chains of binary operations • Explicitly state types when necessary Xbase Workout
  • 14.
    • Avoid clustering– increase memory instead • Use StorageAwareResource • Reduce number of indexed elements • Use parallel code generator • Maven: Avoid composite update sites Builder Katas
  • 15.