[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6735?page=c...
]
Steve Ebersole commented on HHH-6735:
-------------------------------------
Another (probably better) option would be to expose something like
{{org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper.Delegate}} from
{{org.hibernate.tuple.entity.EntityTuplizer}}/{{org.hibernate.persister.entity.EntityPersister}},
but have it be (1) BytecodeProvider-specific and (2) class-specific. Something like:
{code:title=EntityFieldInterceptionDelegate.java|borderStyle=solid}
/**
* Entity-specific delegate for handling bytecode provider field interception calls.
*/
public interface EntityFieldInterceptionDelegate {
/**
* Has the entity class been bytecode instrumented?
*/
public boolean isInstrumented();
/**
* Extract the field interceptor instance from the instrumented entity.
*/
public FieldInterceptor extractInterceptor(Object entity) throws
NotInstrumentedException;
/**
* Inject a field interceptor instance into the instrumented entity.
*/
public FieldInterceptor injectInterceptor(
Object entity,
String entityName,
Set uninitializedFieldNames,
SessionImplementor session) throws NotInstrumentedException;
}
{code}
{code:title=BytecodeProvider.java|borderStyle=solid}
public interface BytecodeProvider {
...
public EntityFieldInterceptionDelegate resolveEntityFieldInterceptionDelegate(Class
entityClass);
}
{code}
etc...
Performance hostpot in
FieldInterceptionHelper.JavassistDelegate.isInstrumented(Class)
--------------------------------------------------------------------------------------
Key: HHH-6735
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6735
Project: Hibernate Core
Issue Type: Improvement
Reporter: Sanne Grinovero
Assignee: Emmanuel Bernard
Fix For: 4.0.0.CR5
Attachments: HibernateCore Hot spots.tar.gz
The method
{code}org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper.JavassistDelegate.isInstrumented(Class){code}
is invoked frequently at runtime, creating a significant performance bottleneck; I'm
attaching the profiling report from a synthetic micro benchmark which is unlikely to be
representative of a real world case, but able to show a waste of 27% of CPU time in this
method only.
From previous discussion:{quote}>
> This is something we should fix in Core; it should be possible to
> associate a "isInstrumented" flag to the Entity, so that we don't
need
> to check the class hierarchy at each invocation? I think this should
> reside in the EntityMetamodel, and the
> FieldInterceptionHelper.isInstrumented be invoked only once per type.
Yes, I think it's a good idea. We will still need
FieldInterceptionHelper.isInstrumented in some situations where the SessionFActory is
unknown but that will help in all the common Hibernate operations.{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira