[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6735?page=c...
]
Steve Ebersole commented on HHH-6735:
-------------------------------------
For example, I see this changeset includes a change to
{{org.hibernate.event.internal.AbstractSaveEventListener#markInterceptorDirty}}
(
https://fisheye2.atlassian.com/viewrep/Hibernate-Core/hibernate-core/src/...)
which changes:
{code}
private void markInterceptorDirty(Object entity, EntityPersister persister, EventSource
source) {
if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
FieldInterceptor interceptor = FieldInterceptionHelper.injectFieldInterceptor(
entity,
persister.getEntityName(),
null,
source
);
interceptor.dirty();
}
}
{code}
to:
{code}
private void markInterceptorDirty(Object entity, EntityPersister persister, EventSource
source) {
InstrumentationService instrumentationService = persister.getFactory()
.getServiceRegistry()
.getService( InstrumentationService.class );
if ( instrumentationService.isInstrumented( entity ) ) {
FieldInterceptor interceptor = FieldInterceptionHelper.injectFieldInterceptor(
entity,
persister.getEntityName(),
null,
source
);
interceptor.dirty();
}
}
{code}
but why not just change that to:
{code}
private void markInterceptorDirty(Object entity, EntityPersister persister, EventSource
source) {
if ( persister.isInstrumented() ) {
FieldInterceptor interceptor = FieldInterceptionHelper.injectFieldInterceptor(
entity,
persister.getEntityName(),
null,
source
);
interceptor.dirty();
}
}
{code}
I have not looked through all the changes, but I cannot imagine there is a time where you
have access to this service but do not have access to the {{EntityPersister}} especially
since the change here states that use of this service is expected only from a
{{SessionFactory}}
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