avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/cli Token.java CLArgsParser.java CLOption.java CLOptionDescriptor.java CLUtil.java
Date Fri, 26 Oct 2001 17:47:14 GMT
Peter Donald wrote:
> 
> Hi,
> 
> I just noticed you were applying a number of optimizations that aren't really
> needed. Private members are implicitly final methods and thus there is no
> need to redundently mark them as such. Methods declared in a final class are
> also final methods and thus there is no reason to redundently specify final
> in this cas either.

Really, then why did I see 20% increase in performance?

> 
> And in a few places you actually put things like
> 
> >       /**
> >        * Convert to a string
> >        */
> >       public final String toString()
> >       {
> >           return new
> > StringBuffer().append(m_type).append(":").append(m_value).toString(); }
> >   }
> 
> which will actually cause a slow down. An optimizing compiler will actually
> work better with
> 
> return m_type + ":" + m_value;
> 
> because it is allowed to transform it into
> 
> final int size =
>   1 +
>   (( null != m_type ) ? m_type.length : 4) +
>   (( null != m_value ) ? m_value.length : 4)
> final StringBuffer sb = new StringBuffer( 9 );
> sb.append( m_type );
> sb.append( ":" );
> sb.append( m_value );
> 
> return sb.toString();
> 
> And things like
> 
> "You cannot lookup components " + "on a disposed ComponentManager"
> 
> are merged at compile time into
> 
> "You cannot lookup components on a disposed ComponentManager"
> 
> So there is no reason to join them in code - especially if it makes for huge
> long lines.
> 
> And things like the following are deliberate attempts to increase readability
> and should not be collapsed into one line.
> 
> final String message =
>   "Extension " + extensions[ i ].getExtensionName() + " is not local";
> throw new IllegalArgumentException( message );
> 
> --
> Cheers,
> 
> Pete
> 
> "The perfect way is only difficult for those who pick and choose.  Do not
> like, do not dislike; all will then be clear.  Make a hairbreadth
> difference and heaven and earth are set apart; if you want the truth to
> stand clear before you, never be for or against." - Bruce Lee
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message