Good Catch! Chad Stansbury! Pity, looks like Peter Donald already checked in the original Perhaps we can get the more optimal code checked in too? Is there an upcoming release of LogKit?
-----Original Message----- From: Chad Stansbury [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 12, 2001 3:09 PM For the speed freaks like myself, here's another optimization to the Date formatter code. You can improve upon the speed by removing the Date instantiation (which in the quoted code will be invoked for each line being logged), and replacing w/ a setTime call... The new code would be: import java.util.Date; import java.text.SimpleDateFormat; SimpleDateFormat m_dateFormatter = null; Date m_date = new Date(); protected String getTime( final long time, final String format ) { if ( format == null ){ return Long.toString( time ); } if (m_dateFormatter == null) { m_dateFormatter = new SimpleDateFormat( format ); } m_date.setTime( System.currentTimeMillis() ); return( m_dateformatter.format( m_date ) ); } Chad Stansbury