[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5790) method BasicBinder#bind() slow because formatting for trace is done also with disabled trace

Guenther Demetz (JIRA) noreply at atlassian.com
Thu Mar 10 05:17:08 EST 2011


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

Guenther Demetz commented on HHH-5790:
--------------------------------------

Method BasicExtractor#extract() still not fixed also in version 3.6.2

> method BasicBinder#bind() slow because formatting for trace is done also with disabled trace
> --------------------------------------------------------------------------------------------
>
>                 Key: HHH-5790
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5790
>             Project: Hibernate Core
>          Issue Type: Improvement
>    Affects Versions: 3.6.0
>         Environment: 3_6_0_final
>            Reporter: Guenther Demetz
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> In the ELSE block of method org.hibernate.type.descriptor.sql.BasicBinder#bind
> the if statement "if (log.isTraceEnabled())" is missing, so strings are formatted 
> even if trace logging is disabled.
> CURRENT CODE:
> if ( value == null ) {
>    if ( log.isTraceEnabled() ) {
> 	log.trace(String.format(...);
>    }
>    st.setNull( index, sqlDescriptor.getSqlType() );
> }
> else {
>    log.trace(String.format(BIND_MSG_TEMPLATE,index, ...);
>    doBind( st, value, index, options );
> }
> IMPROVEMENT:
> if ( value == null ) {
>    if ( log.isTraceEnabled() ) {
> 	log.trace(String.format(...);
>    }
>    st.setNull( index, sqlDescriptor.getSqlType() );
> }
> else {
>    if ( log.isTraceEnabled() ) {                       //// NEW LINE
>         log.trace(String.format(BIND_MSG_TEMPLATE,index, ...);
>    }                                                   //// NEW LINE
>    doBind( st, value, index, options );
> }
> BTW: By doing this little code enhancement, I was able to achieve almost the double speed when inserting data.

-- 
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