Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: blmblm@myrealbox.com Newsgroups: comp.lang.java.programmer Subject: Re: StringBuilder Difficulties Date: 10 Jul 2011 19:08:40 GMT Organization: None Lines: 50 Message-ID: <97ublnFag8U4@mid.individual.net> References: <97otvfFdmmU1@mid.individual.net> X-Trace: individual.net UY7N2m5vtOWg3kuEj4z7IQ2dFm+INlcg9Q8nz/VzdbTKbfw9jF X-Orig-Path: not-for-mail Cancel-Lock: sha1:9lUKQ4P1/Ggc8ilLpczOhQLfoRg= X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6056 In article , Gene Wirchenko wrote: > On 8 Jul 2011 17:44:16 GMT, blmblm@myrealbox.com > wrote: > > >In article , > >Gene Wirchenko wrote: > >> On 6 Jul 2011 16:59:57 GMT, blmblm@myrealbox.com > >> wrote: > >> > >> [snip] > >> > >> >Gene seems to be saying elsethread that in his real code he might > >> >be initializing from something that isn't in order. But assuming he > >> > >> Yup. > >> > >> >could put it in order before initializing the set, then yes, it seems > >> > >> Why bother? SortedSet does the work for me. > > > >If you care enough about performance to have put some effort > >into benchmarking various approaches, I'd have thought you'd be > >interested in one that seems to be significantly faster and almost > >as simple to set up and use. (Probably -- I guess it depends on > >how, in your real code, you'll be initializing the set.) > > But why should I write code to sort something when SortedSet will > do it for me? Plus, if I output the contents of the set, having it in > sorted order makes more sense. > > Remember that I am learning my way around Java. You may already > know how to do it quickly. For me, it would be another thing to find > and figure out. In time, in time. > > >I'm not unsympathetic, though, to a desire to move on once > >an acceptable solution has been found. "Just sayin'", maybe. > > Micro-optimisation is a nasty sin. Yeah, yeah .... I guess it just seems strange to me that you went to all the trouble of writing code to benchmark various approaches -- suggesting that sometimes you *do* engage in micro-optimization -- but are resistant to trying one more approach that (in my tests anyway) sometimes reduced execution time by almost 50%. Just sayin', "whatever", .... :-)? -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.