Home » Modeling » TMF (Xtext) » Performance problem with linking(Validation of CrossReferences in big files)
| | |
Re: Performance problem with linking [message #778423 is a reply to message #778157] |
Thu, 12 January 2012 00:44 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 2012-11-01 14:53, Torsten Schiefer wrote:
> Hi,
> I have a problem with the performance while working in big files.
> My test file has ca. 10000 LOC. The project has ca. 1700 files.
> If I try to work in it, the XText validation checks the crossreferences.
> So my Linker is called. But it is working for a while, so the validator
> is freezing the system.
> That shouldn't be so. How can I suppress this behavior. I would trigger
> the validation per hand every minute or so, but not for every letter I
> write in the file.
> Or can I cache the resolved links?
>
> Thanks, Torsten
If your validation logic requires that linked models are loaded it gets
very expensive. The trick is to make information available in the
descriptors stored in the index instead.
FWIW - Another observation from Geppetto (where I can't use the built in
linking) is that I found that the provided methods that searches the
global index are quite heavy (search for name/type etc.). In my custom
linker I start by building an index with last part of qualified name as
key. This had a more that 10x effect on linking speed in Geppetto. (For
each linked element I typically have to search 3-4 times for different
types and name combinations) so even if there are not 10s of thousands
of files and lines - Geppetto probably does as much linking as when
dealing with the typical style of linking in such a big configuration.
I.e. if you have code that uses the index, as you get over a certain
number of scans of the index, you are better off doing something like I did.
I am using the Eclipse Project model for Containers (using Project
dependencies to control cross project visibility). Maybe the results are
different for other "global scopes" (have not measured).
Although, for headless builds I add everything to the same ResourceSet
and I got the same performance gain there.
Regards
- henrik
|
|
|
Re: Performance problem with linking [message #778566 is a reply to message #778335] |
Fri, 13 January 2012 09:59 |
Torsten Schiefer Messages: 26 Registered: December 2011 |
Junior Member |
|
|
I do not realy know... Which processes are triggered, when I write text in a file?
Is the parse tree renewed? Is the workspace rebuilt, or only the concerned resources are updated? Is the whole file relinked, or only the following lines?
e.g. if I type:
Namespace.functi|CURSOR| //current line, where I write
Namespace2 variable = Namespace2.getInstance(); //following line
In my understanding, the node of "Namespace2" of the next line is interpreted as function of the line I'm typing in, because I haven't typed a ";" yet, by what the corresponding rule is closed. So the parse tree has shifted and all following lines with it. Or not?
While typing the outline tree is updated and the XText validation runs (incl. Linking) everytime (as the "Progress"-View shows). That is realy resource expensive.
When I type in new lines, all following lines must be updatet, for their line numbers and position in the code. Has this anything to do with XText? How reactes it?
|
|
|
Re: Performance problem with linking [message #778579 is a reply to message #778566] |
Fri, 13 January 2012 10:35 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Torsten,
did you actually measure the code or are your findings (e.g. updating
the outline is resource expensive) just based on assumptions?
Xtext does a fairly good job with partial parsing and updated only
subtrees of the node model. However, the complete file has to be
relinked and revalidated because of the open world principle that Xtext
follows. Nothing prevents clients from implementing things like "if
something is named 'foo', exactly 5 other elements have to follow" thus
if you validate only the remainder of the file, stale or missing markers
could occur 5 elements prior to the actual change.
The editor will only work with the current file on type. After you saved
your changes, a builder will pick them up in the background, determine
the potentially affected resources and revalidate only those.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 13.01.12 10:59, schrieb Torsten Schiefer:
> I do not realy know... Which processes are triggered, when I write text
> in a file?
> Is the parse tree renewed? Is the workspace rebuilt, or only the
> concerned resources are updated? Is the whole file relinked, or only the
> following lines?
>
> e.g. if I type:
>
> Namespace.functi|CURSOR| //current line, where I write
>
> Namespace2 variable = Namespace2.getInstance(); //following line
>
> In my understanding, the node of "Namespace2" of the next line is
> interpreted as function of the line I'm typing in, because I haven't
> typed a ";" yet, by what the corresponding rule is closed. So the parse
> tree has shifted and all following lines with it. Or not?
> While typing the outline tree is updated and the XText validation runs
> (incl. Linking) everytime (as the "Progress"-View shows). That is realy
> resource expensive.
>
> When I type in new lines, all following lines must be updatet, for their
> line numbers and position in the code. Has this anything to do with
> XText? How reactes it?
|
|
| | | |
Re: Performance problem with linking [message #778604 is a reply to message #778588] |
Fri, 13 January 2012 13:46 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
Measuring would be good...
BTW, which version are you on?
I had a complex grammar that misbehaved with an older version of Xtext
(don't remember which one) - IIRC it was caused by excessive
backtracking and typing got slower and sloooower, and slooooooower...
Regards
- henrik
On 2012-13-01 13:32, Torsten Schiefer wrote:
> Ok,
> I don't know if the linker is optimized, but I also don't know how to
> make it better. :)
> My language is a very complex one, with unnamed namespaces and two
> combined scopes for importedNamespaces and importURIs.
> There are several forum entries, where I have asked for problem
> solutions. So I did my utmost to optimize the linking and resource
> management.
>
> My possible solution is to trigger the validation, if the user stops
> typing for e.g. 2 seconds or so.
> Is that possible?
>
> Regards,
> Torsten
|
|
| | |
Goto Forum:
Current Time: Sat Apr 20 03:55:32 GMT 2024
Powered by FUDForum. Page generated in 0.04412 seconds
|