[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3909) Improve Performance of FieldInterceptionHandler (and thus of flushing)

Ovidio Mallo (JIRA) noreply at atlassian.com
Thu May 14 12:46:14 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33166#action_33166 ] 

Ovidio Mallo commented on HHH-3909:
-----------------------------------

I have actually run the test suite and Maven claimed that the test you are referring to succeeded. However, when I looked at the test output log today it seems as if the actual tests have been skipped! I see multiple warnings in the log like the following even though the tests are marked as succeeded:
    WARN SKIPPED:120 - *** skipping [org.hibernate.test.instrument.buildtime.InstrumentTest#testPropertyInitialized] - build-time instrumentation : domain classes not instrumented

It seems like the classes are not instrumented. Is this something which does not happen automatically when I execute "mvn test" on the test suite? What would I have to do to get this running?

> Improve Performance of FieldInterceptionHandler (and thus of flushing)
> ----------------------------------------------------------------------
>
>                 Key: HHH-3909
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3909
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.3.1
>            Reporter: Ovidio Mallo
>         Attachments: patch.txt
>
>
> In the FieldInterceptionHelper class, the method Class#getInterfaces() is used in conjunction with a subsequent loop over all interfaces of an entity class in order to check whether a bytecode instrumentation interface of CGlib or Javassist is found. This is done that way since CGlib and Javassist are both optional so they should only be accessed at runtime if available on the classpath. Attached you can find a simple patch which only once checks whether CGlib and/or Javassist is available and then uses the more performant "instanceof" operator in order to check whether an entity has an interceptor. The new code still guarantees that no CGlib or Javassist class is accessed if it is not on the classpath.
> The patch helps making the FieldInterceptionHelper methods more performant which can e.g. be noticed during a session flush, especially if bytecode instrumentation is used. In order to measure the performance impact of the patch I've written a simple program which does the following:
> 1. insert 100 thousand entities into a simple table with 6 numeric attributes
> 2. do an initial flush on the session in order to execute all the insert statements
> 3. loop 300 times and do a flush on the session (only a dirty check is performed, no database operation)
> I've time the flushes under point 3 above with and without bytecode instrumentation for the used entity. Here are the results:
> USING BYTECODE INSTRUMENTATION
> =============================
> * SUN JVM 1.6.0_05:
>   - without patch:  25734ms
>   - with patch:     11015ms
> * IBM JVM 1.4.2:
>   - without patch:  20672ms
>   - with patch:     11140ms
> WITHOUT BYTECODE INSTRUMENTATION
> ================================
> * SUN JVM 1.6.0_05:
>   - without patch:  73328ms
>   - with patch:     62015ms
> * IBM JVM 1.4.2:
>   - without patch:  70344ms
>   - with patch:     61125ms
> Using bytecode instrumentation, the performance improvement is about of a factor of 2-2.5. When not using bytecode instrumentation, the overall impact is of course less relevant since the rest of the work done during flush is more expensive anyway. In any case, IMHO the impact when using bytecode instrumentation is relevant.
> The patch is very simple and only touches the FieldInterceptionHelper class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list