Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #22597
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2013-02-27 13:42 -0800 |
| References | (3 earlier) <kglhdv$kq9$1@dont-email.me> <kgljeg$esp$1@news.albasani.net> <1rcs4eq420jj8.3menl13xfrpv.dlg@40tude.net> <kglnhr$nhj$1@news.albasani.net> <U8uXs.78289$KR.72653@newsfe27.iad> |
| Message-ID | <89669b41-7a35-434e-90cd-57f7342ee70b@googlegroups.com> (permalink) |
| Subject | Re: FastCat 'performance' |
| From | Lew <lewbloch@gmail.com> |
Daniel Pitts wrote: > Jan Burse wrote: > > Joerg Meier schrieb: >>> So, FastCat is doing even worse if .toString() is used. And much, much >>> worse if .toString() is used more than once. >>> > >> Ok, so then. Thanks. > > Now, to be fair to Roedy, you aren't exactly using it "as proscribed", > and you aren't testing the time spent in the constructors. > > I've made the Strings you append longer, and I've fixed the estimates > for the FastCat and the StringBu*ers constructors to be spot-on: > > Fresh SB/FCs: > Cat> Init: 00.000ms, Loop: 00.175ms, End: 00.000ms, Total: 00.175ms. > Buf> Init: 00.000ms, Loop: 00.227ms, End: 00.000ms, Total: 00.227ms. > Bui> Init: 00.000ms, Loop: 00.236ms, End: 00.000ms, Total: 00.236ms. > Reused SB/FCs: > > Cat> Init: 00.000ms, Loop: 00.023ms, End: 00.375ms, Total: 00.398ms. > Buf> Init: 00.101ms, Loop: 00.048ms, End: 00.130ms, Total: 00.279ms. > Bui> Init: 00.092ms, Loop: 00.052ms, End: 00.130ms, Total: 00.274ms. > > For Fresh, Init/End do nothing, but toString() is called every loop. > > For Reused, Init creates the buffer/builder/fastcat, and End is the > single call to toString(). > > If I remove the estimate entirely from StringBu*er constructors, FastCat > does indeed win out. FastCat relies on a "good estimate" to start with, > so I left that estimate in. > > Fresh SB/FCs: > Cat> Init: 00.000ms, Loop: 00.187ms, End: 00.000ms, Total: 00.187ms. > Buf> Init: 00.000ms, Loop: 00.240ms, End: 00.000ms, Total: 00.240ms. > Bui> Init: 00.000ms, Loop: 00.236ms, End: 00.000ms, Total: 00.236ms. > > Reused SB/FCs: > Cat> Init: 00.000ms, Loop: 00.020ms, End: 00.377ms, Total: 00.397ms. > Buf> Init: 00.000ms, Loop: 00.495ms, End: 00.122ms, Total: 00.617ms. > Bui> Init: 00.000ms, Loop: 00.468ms, End: 00.121ms, Total: 00.589ms. > > So, depending on its use, FastCat *can* be about twice as fast as > StringBuffer/StringBuilder. It can, however, be significantly slower as > you have shown. How does it compare to using String +? How does it change after a 10,000-loop warmup to kick in HotSpot? > Sorry Roedy, I'm not going to switch to FastCat any time soon. It's not > a bad idea for a specialized use-case, but as a general use-case not as > good. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
simple StringBuilder proposal Roedy Green <see_website@mindprod.com.invalid> - 2013-02-26 03:53 -0800
Re: simple StringBuilder proposal Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-02-26 15:15 +0000
Re: simple StringBuilder proposal Roedy Green <see_website@mindprod.com.invalid> - 2013-02-27 10:25 -0800
Re: simple StringBuilder proposal Roedy Green <see_website@mindprod.com.invalid> - 2013-02-27 10:30 -0800
Re: simple StringBuilder proposal Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-02-28 08:30 +0000
Re: simple StringBuilder proposal markspace <markspace@nospam.nospam> - 2013-02-28 07:54 -0800
Re: simple StringBuilder proposal markspace <markspace@nospam.nospam> - 2013-02-26 08:31 -0800
Re: simple StringBuilder proposal Lew <lewbloch@gmail.com> - 2013-02-26 10:33 -0800
Re: simple StringBuilder proposal markspace <markspace@nospam.nospam> - 2013-02-26 10:47 -0800
Re: simple StringBuilder proposal Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-02-26 13:29 -0600
Re: simple StringBuilder proposal Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-02-26 12:08 -0800
Re: simple StringBuilder proposal Lew <lewbloch@gmail.com> - 2013-02-26 13:32 -0800
Re: simple StringBuilder proposal Roedy Green <see_website@mindprod.com.invalid> - 2013-02-27 10:33 -0800
Re: simple StringBuilder proposal Robert Klemme <shortcutter@googlemail.com> - 2013-02-26 22:53 +0100
Re: simple StringBuilder proposal markspace <markspace@nospam.nospam> - 2013-02-26 15:54 -0800
Re: simple StringBuilder proposal Robert Klemme <shortcutter@googlemail.com> - 2013-03-01 07:35 +0100
Re: simple StringBuilder proposal Roedy Green <see_website@mindprod.com.invalid> - 2013-02-27 10:31 -0800
Re: simple StringBuilder proposal Sven Köhler <remove-sven.koehler@gmail.com> - 2013-02-28 05:14 +0100
Re: simple StringBuilder proposal Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-26 09:41 -0800
Re: simple StringBuilder proposal Jan Burse <janburse@fastmail.fm> - 2013-02-26 20:21 +0100
Re: simple StringBuilder proposal Joerg Meier <joergmmeier@arcor.de> - 2013-02-26 23:07 +0100
Re: simple StringBuilder proposal Jan Burse <janburse@fastmail.fm> - 2013-02-27 00:09 +0100
Re: simple StringBuilder proposal Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-26 15:19 -0800
Re: simple StringBuilder proposal Jim Janney <jjanney@shell.xmission.com> - 2013-02-27 09:34 -0700
Re: simple StringBuilder proposal Jan Burse <janburse@fastmail.fm> - 2013-02-27 19:18 +0100
Re: simple StringBuilder proposal Arne Vajhøj <arne@vajhoej.dk> - 2013-02-27 19:56 -0500
Re: simple StringBuilder proposal Jan Burse <janburse@fastmail.fm> - 2013-02-28 10:19 +0100
Re: simple StringBuilder proposal Arne Vajhøj <arne@vajhoej.dk> - 2013-02-28 08:16 -0500
Re: simple StringBuilder proposal Jim Janney <jjanney@shell.xmission.com> - 2013-02-28 16:40 -0700
Re: simple StringBuilder proposal Arne Vajhøj <arne@vajhoej.dk> - 2013-02-28 18:51 -0500
Re: simple StringBuilder proposal Arne Vajhøj <arne@vajhoej.dk> - 2013-02-27 20:01 -0500
Re: simple StringBuilder proposal Silvio <silvio@internet.com> - 2013-02-26 22:03 +0100
Re: simple StringBuilder proposal Silvio <silvio@internet.com> - 2013-02-26 22:04 +0100
Re: simple StringBuilder proposal Sven Köhler <remove-sven.koehler@gmail.com> - 2013-02-27 03:47 +0100
FastCat 'performance' (was: simple StringBuilder proposal) Joerg Meier <joergmmeier@arcor.de> - 2013-02-27 18:16 +0100
Re: FastCat 'performance' markspace <markspace@nospam.nospam> - 2013-02-27 09:58 -0800
Re: FastCat 'performance' Jan Burse <janburse@fastmail.fm> - 2013-02-27 19:31 +0100
Re: FastCat 'performance' Joerg Meier <joergmmeier@arcor.de> - 2013-02-27 20:00 +0100
Re: FastCat 'performance' Jan Burse <janburse@fastmail.fm> - 2013-02-27 20:41 +0100
Re: FastCat 'performance' Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-27 12:38 -0800
Re: FastCat 'performance' Joerg Meier <joergmmeier@arcor.de> - 2013-02-27 21:58 +0100
Re: FastCat 'performance' Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-27 13:32 -0800
Re: FastCat 'performance' Lew <lewbloch@gmail.com> - 2013-02-27 13:42 -0800
Re: FastCat 'performance' Lew <lewbloch@gmail.com> - 2013-02-27 13:44 -0800
Re: FastCat 'performance' Joerg Meier <joergmmeier@arcor.de> - 2013-02-27 22:51 +0100
Re: FastCat 'performance' Sven Köhler <remove-sven.koehler@gmail.com> - 2013-02-28 05:19 +0100
Re: FastCat 'performance' Joerg Meier <joergmmeier@arcor.de> - 2013-02-28 13:09 +0100
Re: FastCat 'performance' markspace <markspace@nospam.nospam> - 2013-02-27 13:57 -0800
Re: FastCat 'performance' Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-27 15:23 -0800
Re: FastCat 'performance' Arne Vajhøj <arne@vajhoej.dk> - 2013-02-27 18:52 -0500
Re: FastCat 'performance' Sven Köhler <remove-sven.koehler@gmail.com> - 2013-03-01 17:26 +0100
Re: FastCat 'performance' Sven Köhler <remove-sven.koehler@gmail.com> - 2013-02-27 21:00 +0100
Re: FastCat 'performance' (was: simple StringBuilder proposal) Wanja Gayk <brixomatic@yahoo.com> - 2013-03-27 10:17 +0100
csiph-web