[sip-comm-dev] Use of StringBuffer


#1

Hello,
as Werner started working on optimization of the logger usage, I will
start looking at the use of StringBuffer class.
Since java 5 a new class, StringBuilder was introduced, and does
exactly the same thing but is not synchronized, meaning that it is
faster. And since in most case we don't need synchronization on
StringBuffer I think replacing them (when possible) is a good idea.

Matthieu

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hi, have you done any profiling proving that the effort will yield some
benefits? Modern JVM implementations can remove locks from local scoped
variables, so most of the time there's no actual difference between both
implementations.

My 2 cents.

···

On 3 June 2010 09:25, Matthieu Casanova <chocolat.mou@gmail.com> wrote:

Hello,
as Werner started working on optimization of the logger usage, I will
start looking at the use of StringBuffer class.
Since java 5 a new class, StringBuilder was introduced, and does
exactly the same thing but is not synchronized, meaning that it is
faster. And since in most case we don't need synchronization on
StringBuffer I think replacing them (when possible) is a good idea.

Matthieu

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

You're right about one thing, it will not be a major performance
enhancement, anyway even if some JVMs are able to do that
optimization, I think it is always a good idea to use the good class
at the good place (we could say the same for Vector vs ArrayList,
Hashtable vs HashMap) isn't it ?

Matthieu

···

2010/6/3 Pablo Saavedra <pablo.a.saavedra@gmail.com>:

Hi, have you done any profiling proving that the effort will yield some
benefits? Modern JVM implementations can remove locks from local scoped
variables, so most of the time there's no actual difference between both
implementations.
My 2 cents.

On 3 June 2010 09:25, Matthieu Casanova <chocolat.mou@gmail.com> wrote:

Hello,
as Werner started working on optimization of the logger usage, I will
start looking at the use of StringBuffer class.
Since java 5 a new class, StringBuilder was introduced, and does
exactly the same thing but is not synchronized, meaning that it is
faster. And since in most case we don't need synchronization on
StringBuffer I think replacing them (when possible) is a good idea.

Matthieu

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Of course, I just meant to suggest that there are other things that would
bring greater benefits and might be worth looking at them first.

Regards.

···

On 3 June 2010 10:59, Matthieu Casanova <chocolat.mou@gmail.com> wrote:

You're right about one thing, it will not be a major performance
enhancement, anyway even if some JVMs are able to do that
optimization, I think it is always a good idea to use the good class
at the good place (we could say the same for Vector vs ArrayList,
Hashtable vs HashMap) isn't it ?

Matthieu

2010/6/3 Pablo Saavedra <pablo.a.saavedra@gmail.com>:
> Hi, have you done any profiling proving that the effort will yield some
> benefits? Modern JVM implementations can remove locks from local scoped
> variables, so most of the time there's no actual difference between both
> implementations.
> My 2 cents.
>
> On 3 June 2010 09:25, Matthieu Casanova <chocolat.mou@gmail.com> wrote:
>>
>> Hello,
>> as Werner started working on optimization of the logger usage, I will
>> start looking at the use of StringBuffer class.
>> Since java 5 a new class, StringBuilder was introduced, and does
>> exactly the same thing but is not synchronized, meaning that it is
>> faster. And since in most case we don't need synchronization on
>> StringBuffer I think replacing them (when possible) is a good idea.
>>
>> Matthieu
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
>> For additional commands, e-mail: dev-help@sip-communicator.dev.java.net
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#5

Oh no, it is not a great benefit, only a minor one

···

2010/6/3 Pablo Saavedra <pablo.a.saavedra@gmail.com>:

Of course, I just meant to suggest that there are other things that would
bring greater benefits and might be worth looking at them first.
Regards.

On 3 June 2010 10:59, Matthieu Casanova <chocolat.mou@gmail.com> wrote:

You're right about one thing, it will not be a major performance
enhancement, anyway even if some JVMs are able to do that
optimization, I think it is always a good idea to use the good class
at the good place (we could say the same for Vector vs ArrayList,
Hashtable vs HashMap) isn't it ?

Matthieu

2010/6/3 Pablo Saavedra <pablo.a.saavedra@gmail.com>:
> Hi, have you done any profiling proving that the effort will yield some
> benefits? Modern JVM implementations can remove locks from local scoped
> variables, so most of the time there's no actual difference between both
> implementations.
> My 2 cents.
>
> On 3 June 2010 09:25, Matthieu Casanova <chocolat.mou@gmail.com> wrote:
>>
>> Hello,
>> as Werner started working on optimization of the logger usage, I will
>> start looking at the use of StringBuffer class.
>> Since java 5 a new class, StringBuilder was introduced, and does
>> exactly the same thing but is not synchronized, meaning that it is
>> faster. And since in most case we don't need synchronization on
>> StringBuffer I think replacing them (when possible) is a good idea.
>>
>> Matthieu
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
>> For additional commands, e-mail: dev-help@sip-communicator.dev.java.net
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net