Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » cached models
cached models [message #835659] Tue, 03 April 2012 14:09 Go to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Another weird question from yours truly Smile

We have a large code base and it takes quite a while to parse everything when a project is open. Besides, most of the time people will navigate the code in read-only mode. To me, it makes sense to make sure that the serialized model for the baseline is available offline and let the framework use it directly instead of building it again and again.

Is there support to do that in Xtext? More precisely, when opening a resource I want to be able to skip parsing it and use a serialized model from somewhere.

My guess would be that I need to override the XtextResourceFactory to provide my special XtextResource that overrides doLoad, where I can fake calling the parser. Would that be enough?

best regards,
Vlad
Re: cached models [message #835737 is a reply to message #835659] Tue, 03 April 2012 15:58 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Vlad,

you may want to try the features that are available here:
https://github.com/mark-christiaens/xtext

It will not make it into Xtext 2.3, but we have are currently working on
the necessary infrastructure changes to allow clients to implement that
without forking Xtext: https://bugs.eclipse.org/bugs/show_bug.cgi?id=359824

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

Am 03.04.12 16:09, schrieb Vlad Dumitrescu:
> Another weird question from yours truly :)
> We have a large code base and it takes quite a while to parse everything
> when a project is open. Besides, most of the time people will navigate
> the code in read-only mode. To me, it makes sense to make sure that the
> serialized model for the baseline is available offline and let the
> framework use it directly instead of building it again and again.
>
> Is there support to do that in Xtext? More precisely, when opening a
> resource I want to be able to skip parsing it and use a serialized model
> from somewhere.
>
> My guess would be that I need to override the XtextResourceFactory to
> provide my special XtextResource that overrides doLoad, where I can fake
> calling the parser. Would that be enough?
>
> best regards,
> Vlad
>
Re: cached models [message #835857 is a reply to message #835737] Tue, 03 April 2012 19:15 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Thank you for the hint, Sebastian. I'm not sure that we will want to use an unofficial build, but it feels good that a solution is in the works. Hopefully it will make it into 2.4 (by December?)

best regards,
Vlad
Re: cached models [message #836423 is a reply to message #835857] Wed, 04 April 2012 13:27 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Hi,

We could have a poor man's cache by persisting the Xtext index in the workspace, giving it a head start next time we open the workspace. I couldn't find if this is done today, would it have a chance to be in 2.3?

This of course assumes that when a file is parsed, the result is saved in the index and the file doesn't need to be reparsed in the same session unless it changes.

regards,
Vlad
Re: cached models [message #836430 is a reply to message #836423] Wed, 04 April 2012 13:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the index is persited in the workspace by default. see org.eclipse.xtext.builder.builderState.PersistedStateProvider.
so i do not get your point.

But: of course the parsed file is not stored in the index. btw parsing is usually not the problem. linking and validation usually cost more time.
=> you have to patch/fork xtext or live with what is there.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cached models [message #836447 is a reply to message #836430] Wed, 04 April 2012 13:51 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Thank you christian.

I still have to get used to the fact that the index is updated by a builder. I looked in the wrong places Sad

Would it work to open for example a large library in my workspace, build a complete index for it and publish it so that it can be copied to another workspaces, where 100 users can skip the lengthy operation? I'm not sure what would happen if the workspaces have different projects open, but it's something worth trying unless you tell me it's crazy Smile

regards,
Vlad
Re: cached models [message #836452 is a reply to message #836447] Wed, 04 April 2012 13:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

if you clean the project or explictely build it it is of course updated. same if you change some files.
=> you should investigate what triggers the rebuild.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cached models [message #836456 is a reply to message #836452] Wed, 04 April 2012 14:00 Go to previous message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Thanks, I'll check that, maybe it's good enough for our purposes.
regards,
Vlad
Previous Topic:Outline view contribution with Xtext 2.3M6
Next Topic:Cannot cast to XbaseScopeProvider
Goto Forum:
  


Current Time: Wed Apr 24 17:17:15 GMT 2024

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

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

Back to the top