[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5790?page=c...
]
Guenther Demetz commented on HHH-5790:
--------------------------------------
Same problem detected in method BasicExtractor#extract() when reading data from database,
also here on line 70 the "if (log.isTraceEnabled())" is missing.
public J extract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
final J value = doExtract( rs, name, options );
if ( value == null || rs.wasNull() ) {
log.trace( "found [null] as column [{}]", name );
return null;
}
else {
if (log.isTraceEnabled()) { /// Enhancement HHH-5790,
extractLoggableRepresentation() consumes cpu
log.trace( "found [{}] as column [{}]",
getJavaDescriptor().extractLoggableRepresentation( value ), name );
} /// Enhancement HHH-5790
return value;
}
}
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira