[SNMP4J] Minor optimization in PDU.toString() method

Frank Fock fock at agentpp.com
Mon Dec 5 23:56:02 CET 2005


Of course, you are right - although I doubt that you can measure the 
difference ;-)
Anyway, I will change it for the next release...

Best regards,
Frank

Matthieu Casanova wrote:

> Hi, you're probably right but it will not use your StringBuffer and it 
> will probably create a new one just for this line I think, don't you ?
>
> Matthieu
>
> 2005/12/2, Frank Fock < fock at agentpp.com <mailto:fock at agentpp.com>>:
>
>     Hi,
>
>     Yes, Java 1.4 or later uses StringBuffer for String concatenation.
>     So, there is no need for optimization.
>
>     Best regards,
>     Frank
>
>     Alan D. Cabrera wrote:
>
>     > Is explicit string buffer usage still required?  I thought that the
>     > compiler automatically used them for string contacts.
>     >
>     >
>     > Regards,
>     > Alan
>     >
>     > Matthieu Casanova wrote, On 12/2/2005 1:26 AM:
>     >
>     >> Hi, il the last release 1.6b (but probably in previous one)
>     there is
>     >> a minor
>     >> optimization to do :
>     >>
>     >> The method contains line 601 this
>     >> buf.append(getErrorStatusText()+"("+errorStatus+")");
>     >>
>     >> Since we have a StringBuffer it would be better to use it for
>     those
>     >> String
>     >> concatenations like that
>     >> buf.append(getErrorStatusText());
>     >> buf.append('(');
>     >> buf.append(errorStatus);
>     >> buf.append(')');
>     >>
>     >> Matthieu
>     >> _______________________________________________
>     >> SNMP4J mailing list
>     >> SNMP4J at agentpp.org <mailto:SNMP4J at agentpp.org>
>     >> http://lists.agentpp.org/mailman/listinfo/snmp4j
>     >>
>     >>
>     >
>     > _______________________________________________
>     > SNMP4J mailing list
>     > SNMP4J at agentpp.org <mailto:SNMP4J at agentpp.org>
>     > http://lists.agentpp.org/mailman/listinfo/snmp4j
>     >
>     >
>
>
>     --
>     AGENT++
>     http://www.agentpp.com <http://www.agentpp.com>
>     http://www.mibexplorer.com
>     http://www.mibdesigner.com
>
>
>


-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com





More information about the SNMP4J mailing list