Bug 113855 - [expressions] Support adapater information caching in expressions
Summary: [expressions] Support adapater information caching in expressions
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-26 12:47 EDT by Douglas Pollock CLA
Modified: 2019-09-06 15:37 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Pollock CLA 2005-10-26 12:47:17 EDT
It would be nice if some class hierarchy information could be cached in an 
EvaluationContext, when evaluating an AdaptExpression.  A common case is to 
have a common evaluation context which will be used to evaluate several (i.e., 
perhaps hundreds) of expressions.  It would be nice if it were possible to 
cache some of the hierarchy information, rather than recomputing it each time.
Comment 1 Dirk Baeumer CLA 2005-10-27 05:09:23 EDT
Hi Douglas,

I see your point the only problem is that the adpat is not statically and might
therefore not be cachable. For example:

IAdaptable a= ....;

IResource r= (IResource)a.getAdapter(IResource.class);
assert(r == null);
....
IResource r= (IResource)a.getAdapter(IResource.class);
assert(r != null);

could be completely legal code since whether or not a object is adaptable could
depend on some state of that object or even on some state of the adpater factory.

So this can only be optional where the evaluator knows about the adapt behaviour
of the variables.
Comment 2 Douglas Pollock CLA 2005-10-27 09:33:30 EDT
I realize now the the Summary was a bit misleading.  I was thinking more of 
caching the superclass/interface/superinterface look-ups.  My thought was also 
to use the EvaluationContext itself to cache the information.  This gives some 
control to the application as to when this information is flushed. 
 
Comment 3 Dirk Baeumer CLA 2005-10-27 11:36:19 EDT
Hmm, may be I am not understanding it but the adapt expression is using core API
to actually do the adaption. 

IAdapterManager manager= Platform.getAdapterManager();
if (!manager.hasAdapter(var, fTypeName))
	return EvaluationResult.FALSE;
adapted= manager.getAdapter(var, fTypeName);

I don't see how we can cache anything there (I even think core is already doing
some caching here).
Comment 4 Douglas Pollock CLA 2005-10-27 12:03:07 EDT
It's possible I'm misunderstanding.  My concern is more with this line:  
    Expressions.isInstanceOf(var, fTypeName)  
  
Jean-Michel would understand more, as he wrote the caching mechanism used in  
ObjectContributorManager. 
Comment 5 Dirk Baeumer CLA 2005-10-27 14:01:06 EDT
OK, now I understand.

Michael, is there some API code I can resue ?
Comment 6 Jean-Michel Lemieux CLA 2005-10-31 09:33:35 EST
Now although this was a while ago, let me see if I can remember any of the
details. Most of the performance problems I found trying to add support for true
adaptable contributors related to hierarchy checks based on type name. There
were others, like finding the common types for a selection considering adapters.
I thought of adding the type lookup cache in AdapterManager, because that is a
good common class which performs the lookup already. 

Another performance issue, or plug-in loading, is how often the selection is
adapted to the target type for each action. For example, if 5 actions take IFoo
types, then how many type does the contribution code traverse the selection and
adapt it?

I propose that you profile the new code before jumping to conclusions though.
Comment 7 Dani Megert CLA 2009-03-24 13:03:27 EDT
Moving bugs due to ownership change.
Comment 8 Eclipse Webmaster CLA 2019-09-06 15:37:04 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.