Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Pre-compiled OCL expressions?
Pre-compiled OCL expressions? [message #68484] Fri, 06 March 2009 06:40 Go to next message
Eclipse UserFriend
Originally posted by: zzhangh.cn.ibm.com

Hi all,
I got a set of OCL expressions, and had to evaluate them with thousands of objects. I'm wondering if the OCL expressions
can be pre-compiled (or any other related mechanism) to improve the performance, thanks!

Regards,
Hao
Re: Pre-compiled OCL expressions? [message #68518 is a reply to message #68484] Fri, 06 March 2009 14:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Hao,

Yes, that's precisely what you get when you parse the expression: a
compiled form of it. Are you parsing every time you need to evaluate
the OCL expression? You can parse the expression, encapsulate it in a
Query (OCL::createQuery(...) method), and feed all of your objects into
that query one by one. Or, even, send them all in as a list and let the
query return the corresponding list of results. This has the benefit of
caching, for example, the class extents for allInstances() operation
between evaluations.

Otherwise, you'd be looking at some kind of OCL-to-Java compiler such as
was prototyped in the defunct OCLTools component. You may still find
links to some of that code from the Eclipse Wiki. Note, though, that
Miguel's initial trials showed only a 2-fold performance increase in the
compiled-to-Java OCL over the interpreted OCL. For many applications,
that wouldn't be a determining factor.

HTH,

Christian



Hao Zhang wrote:
> Hi all,
> I got a set of OCL expressions, and had to evaluate them with thousands of objects. I'm wondering if the OCL expressions
> can be pre-compiled (or any other related mechanism) to improve the performance, thanks!
>
> Regards,
> Hao
Re: Pre-compiled OCL expressions? [message #68571 is a reply to message #68518] Mon, 09 March 2009 03:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zzhangh.cn.ibm.com

Hi Christian,
Sounds interesting, I'll give it a try. One more question:
Can these query objects be persisted, so that potentially I can have them back more quickly the next time I run my program.

Regards,
Hao

Christian W. Damus Wrote:
> Hi, Hao,
>
> Yes, that's precisely what you get when you parse the expression: a
> compiled form of it. Are you parsing every time you need to evaluate
> the OCL expression? You can parse the expression, encapsulate it in a
> Query (OCL::createQuery(...) method), and feed all of your objects into
> that query one by one. Or, even, send them all in as a list and let the
> query return the corresponding list of results. This has the benefit of
> caching, for example, the class extents for allInstances() operation
> between evaluations.
>
> Otherwise, you'd be looking at some kind of OCL-to-Java compiler such as
> was prototyped in the defunct OCLTools component. You may still find
> links to some of that code from the Eclipse Wiki. Note, though, that
> Miguel's initial trials showed only a 2-fold performance increase in the
> compiled-to-Java OCL over the interpreted OCL. For many applications,
> that wouldn't be a determining factor.
>
> HTH,
>
> Christian
>
>
>
> Hao Zhang wrote:
>> Hi all,
>> I got a set of OCL expressions, and had to evaluate them with
>> thousands of objects. I'm wondering if the OCL expressions
>> can be pre-compiled (or any other related mechanism) to improve the
>> performance, thanks!
>>
>> Regards,
>> Hao
Re: Pre-compiled OCL expressions? [message #68608 is a reply to message #68571] Wed, 11 March 2009 13:25 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Hao,

No, the Query cannot be persisted, but the expression that it evaluates
can. Persistence of the EvaluationEnvironment encapsulated by the Query
doesn't make sense, as it includes caches of the current model state,
which quickly become stale.

The cost of creating new Query instances is quite small compared to parsing.

Cheers,

Christian

Hao Zhang wrote:
> Hi Christian,
> Sounds interesting, I'll give it a try. One more question:
> Can these query objects be persisted, so that potentially I can have
> them back more quickly the next time I run my program.
>
> Regards,
> Hao
>
> Christian W. Damus Wrote:
>> Hi, Hao,
>>
>> Yes, that's precisely what you get when you parse the expression: a
>> compiled form of it. Are you parsing every time you need to evaluate
>> the OCL expression? You can parse the expression, encapsulate it in a
>> Query (OCL::createQuery(...) method), and feed all of your objects
>> into that query one by one. Or, even, send them all in as a list and
>> let the query return the corresponding list of results. This has the
>> benefit of caching, for example, the class extents for allInstances()
>> operation between evaluations.
>>
>> Otherwise, you'd be looking at some kind of OCL-to-Java compiler such
>> as was prototyped in the defunct OCLTools component. You may still
>> find links to some of that code from the Eclipse Wiki. Note, though,
>> that Miguel's initial trials showed only a 2-fold performance increase
>> in the compiled-to-Java OCL over the interpreted OCL. For many
>> applications, that wouldn't be a determining factor.
>>
>> HTH,
>>
>> Christian
>>
>>
>>
>> Hao Zhang wrote:
>>> Hi all,
>>> I got a set of OCL expressions, and had to evaluate them with
>>> thousands of objects. I'm wondering if the OCL expressions
>>> can be pre-compiled (or any other related mechanism) to improve the
>>> performance, thanks!
>>>
>>> Regards,
>>> Hao
Previous Topic:OCL Console in SR2
Next Topic:Direct access to pre/post conditions of an context operation
Goto Forum:
  


Current Time: Mon Dec 22 06:35:33 GMT 2014

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

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