Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320703 - [tests] Xtext parser is eleven times slower
Summary: [tests] Xtext parser is eleven times slower
Status: CLOSED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: RC1   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-23 05:50 EDT by Ed Willink CLA
Modified: 2014-05-27 09:52 EDT (History)
2 users (show)

See Also:


Attachments
JUnit tests to measure parser speed (25.02 KB, patch)
2010-07-23 05:50 EDT, Ed Willink CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2010-07-23 05:50:05 EDT
Created attachment 175046 [details]
JUnit tests to measure parser speed

Comparison of parser speed for RoyalAndLoyal.ocl suggests that the Xtext parser is eleven times slower than the LPG parser. (1.1 compared to 0.1 seconds for 350 lines). See MODELS 2010 OCL workshop paper submission for details.

[Something dreadful happens if the full LoadTest is run. Saving the Xtext results takes 60 seconds every time.]
Comment 1 Sebastian Zarnekow CLA 2010-07-26 16:01:44 EDT
Hi Ed,

did you try to enable memoization for your parser?
Comment 2 Ed Willink CLA 2010-07-26 16:09:46 EDT
No. What is memoization? There is no mention in the Xtext user guide.
Comment 3 Sebastian Zarnekow CLA 2010-07-26 16:12:16 EDT
pleaes add 

options = {
  backtrack = true
  memoize = true
}

to the workflow that generates the parsers. It enables caching for the backtracking algorithm of Antlr.
Comment 4 Ed Willink CLA 2010-07-26 16:49:18 EDT
Changing

options = { backtrack = true classSplitting = true }

to

options = { backtrack = true memoize =true classSplitting = true }

seems to make no difference to the speed.
Comment 5 Ed Willink CLA 2011-05-04 14:46:49 EDT
Generalizing the grammar to avoid backtracking reduced the speed difference to perhaps two times.
Comment 6 Ed Willink CLA 2013-05-20 07:39:15 EDT
Two times will do. Xtext2LPG is a separate issue.
Comment 7 Ed Willink CLA 2014-05-27 09:43:45 EDT
CLOSED after more than a year in RESOLVED state.
Comment 8 Ed Willink CLA 2014-05-27 09:52:31 EDT
and CLOSE