Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Performance problem with linking(Validation of CrossReferences in big files)
Performance problem with linking [message #778157] Wed, 11 January 2012 13:52 Go to next message
Torsten Schiefer is currently offline Torsten SchieferFriend
Messages: 26
Registered: December 2011
Junior Member
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
Re: Performance problem with linking [message #778335 is a reply to message #778157] Thu, 12 January 2012 12:45 Go to previous messageGo to next message
Torsten Schiefer is currently offline Torsten SchieferFriend
Messages: 26
Registered: December 2011
Junior Member
The interesting fact is. The more I am manipulating in the file the more resource descritions will be put in the updating list ("Building Workspace"), even if they are allready in the list.
Re: Performance problem with linking [message #778418 is a reply to message #778157] Wed, 11 January 2012 16:22 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Torsten,

without more information it's hard to tell what's going on on your side.
I'm aware of use cases with a couple of thousand files that perform
quite well. It always depends on your scoping / validation implementation.
Resolved links are cached by EMF automatically by means of resolved proxies.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 11.01.12 14:53, schrieb Torsten Schiefer:
> 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
Re: Performance problem with linking [message #778423 is a reply to message #778157] Thu, 12 January 2012 00:44 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
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 Go to previous messageGo to next message
Torsten Schiefer is currently offline Torsten SchieferFriend
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 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
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 #778581 is a reply to message #778579] Fri, 13 January 2012 11:03 Go to previous messageGo to next message
Torsten Schiefer is currently offline Torsten SchieferFriend
Messages: 26
Registered: December 2011
Junior Member
Hello Sebastian,
thank you for your reply.

I din't measure, I feel it. Wink But the user of my editor feels it too. And that's the problem.

Perhaps my Outline can be optimized, that's not the problem. But the Linker can't be optimized any more. And that's my problem.
And when the relinking is started with every letter I type, my editor is realy slow.

Regards,
Torsten
Re: Performance problem with linking [message #778582 is a reply to message #778581] Fri, 13 January 2012 11:17 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Torsten,

why do you think that your linker as optimized as far as possible if you
did not measure the hot spots?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 13.01.12 12:03, schrieb Torsten Schiefer:
> Hello Sebastian,
> thank you for your reply.
>
> I din't measure, I feel it. ;) But the user of my editor feels it too.
> And that's the problem.
>
> Perhaps my Outline can be optimized, that's not the problem. But the
> Linker can't be optimized any more. And that's my problem.
> And when the relinking is started with every letter I type, my editor is
> realy slow.
>
> Regards,
> Torsten
Re: Performance problem with linking [message #778588 is a reply to message #778582] Fri, 13 January 2012 12:32 Go to previous messageGo to next message
Torsten Schiefer is currently offline Torsten SchieferFriend
Messages: 26
Registered: December 2011
Junior Member
Ok,
I don't know if the linker is optimized, but I also don't know how to make it better. Smile
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
Re: Performance problem with linking [message #778604 is a reply to message #778588] Fri, 13 January 2012 13:46 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
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
Re: Performance problem with linking [message #778610 is a reply to message #778604] Fri, 13 January 2012 14:04 Go to previous messageGo to next message
Torsten Schiefer is currently offline Torsten SchieferFriend
Messages: 26
Registered: December 2011
Junior Member
Hello Henrik,

I'm on version 2.1.0.
A full Clean of my project takes ca. 7 min (40 sec scoping, 6 min 20 sec linking), because I have to do much linking by hand.
That's very much, but tolerable. But the slow work at the program code isn't.

My grammar doesn't use backtracking, except for the well-known if..then..else problem.
Re: Performance problem with linking [message #778718 is a reply to message #778588] Fri, 13 January 2012 17:31 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 13.01.12 13:32, schrieb Torsten Schiefer:
> 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

That's what Xtext does for your. Partial parsing is triggered if the
editor is idle for 500ms. Validation kicks in afterwards
(asynchronously) and it will be cancelled automatically as soon as the
user edits the document again.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:Lexer too big
Next Topic:Embedding a language in Java comments/annotations
Goto Forum:
  


Current Time: Sat Apr 20 03:55:32 GMT 2024

Powered by FUDForum. Page generated in 0.04412 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top