Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #5845

Re: baseline performance test using java ...

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!h38g2000pro.googlegroups.com!not-for-mail
From lewbloch <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: baseline performance test using java ...
Date Mon, 4 Jul 2011 03:53:33 -0700 (PDT)
Organization http://groups.google.com
Lines 33
Message-ID <5ef548cb-0f5b-4008-8169-b0145d54d847@h38g2000pro.googlegroups.com> (permalink)
References <1309715588.716395@nntp.aceinnovative.com> <iuqcm0$tmh$2@speranza.aioe.org> <vt2dnfwXi-FFJY3TnZ2dnUVZ_tqdnZ2d@earthlink.com> <iur4jt$mbn$1@speranza.aioe.org>
NNTP-Posting-Host 108.89.33.208
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1309777182 25874 127.0.0.1 (4 Jul 2011 10:59:42 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Mon, 4 Jul 2011 10:59:42 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info h38g2000pro.googlegroups.com; posting-host=108.89.33.208; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order HNKRUAELSC
X-HTTP-UserAgent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30,gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5845

Show key headers only | View raw


Abu Yahya wrote:
> Patricia Shanahan wrote:
>> Abu Yahya wrote:
>>> If you need to build them, you'd need a StringBuilder. And if you need
>>> support for multiple threads AND need to modify them, you'd need a
>>> StringBuffer.
>

>> Often, the StringBuffer locking is not strong enough to be really
>> useful. If, for example, a thread needs to append two strings to the
>> buffer and have them appear consecutively in the resulting string, it
>> needs synchronization at a higher level.
>

> True. StringBuffer's locking will only help in guaranteeing an output in
> which either the first string /or/ the second string is /completely/
> appended first. If the order matters, the built-in locking won't help.

That's a small part of the story, and not accurate anyway.

 StringBuffer sb;
 ...
 sb.append( firstString ).append( secondString );

/happens-before/ guarantees that the second 'append()' will
concatenate after the first one.  Once the second 'append()'
completes, all threads are guaranteed to see the effects of both
'append()'s.  The synchronization inbuilt to 'StringBuffer' does not
guarantee that some thread won't intervene between the two
'append()'s.

--
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

baseline performance test using java ... lbrt chx _ gemale kom - 2011-07-03 17:53 +0000
  Re: baseline performance test using java ... Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-03 14:08 -0400
  Re: baseline performance test using java ... Abu Yahya <abu_yahya@invalid.com> - 2011-07-04 00:03 +0530
    Re: baseline performance test using java ... Patricia Shanahan <pats@acm.org> - 2011-07-03 11:45 -0700
      Re: baseline performance test using java ... Abu Yahya <abu_yahya@invalid.com> - 2011-07-04 06:52 +0530
        Re: baseline performance test using java ... lewbloch <lewbloch@gmail.com> - 2011-07-04 03:53 -0700
    Re: baseline performance test using java ... lewbloch <lewbloch@gmail.com> - 2011-07-04 03:44 -0700
  Re: baseline performance test using java ... Patricia Shanahan <pats@acm.org> - 2011-07-03 12:09 -0700
  Re: baseline performance test using java ... Patricia Shanahan <pats@acm.org> - 2011-07-04 09:54 -0700

csiph-web