[jsword-devel] StringBuffer

Marcin Sanecki marcin.sanecki at gmail.com
Sun Jan 9 05:29:45 MST 2011


Hi All,
I am wondering if this kind of optimization it's really needed.
Donald Knuth said a long time ago that the difference between
micro-optimizations and premature
optimizations is that the first ones are driven by measurement while the second
ones are driven by guesses, intuitions and hunches.

@Chris - you guess or you have measured it?

Marcin

2011/1/9 Chris Burrell <chris at burrell.me.uk>:
> Hi All
> In my not-so-recent version of JSword I count 133 matches of StringBuffer
> and 0 matches to StringBuilder
> Str]ingBuilder is much faster, because it is not synchronised / thread-safe.
> So, everytime StringBuffer is declared in a local method, we can replace it
> by a StringBuilder. Since the instance will never be shared. If the instance
> is a instance of the object or a static instance at the top, then we can't
> touch it.
> Are there other reasons why we are using StringBuffer?
> Chris
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>



More information about the jsword-devel mailing list