Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320703

Summary: [tests] Xtext parser is eleven times slower
Product: [Modeling] OCL Reporter: Ed Willink <ed>
Component: CoreAssignee: OCL Inbox <mdt-ocl-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: juan.cadavid, sebastian.zarnekow
Version: 3.0.0   
Target Milestone: RC1   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
JUnit tests to measure parser speed none

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