Gap Buffer based AbstractStringBuilder implementation
Martin Buchholz
martinrb at google.com
Thu Nov 26 06:02:36 UTC 2009
On Wed, Nov 25, 2009 at 21:24, Martin Buchholz <martinrb at google.com> wrote:
> On Mon, Nov 23, 2009 at 22:51, Goktug Gokdogan <gokdogan at gmail.com> wrote:
>> Nobody is interested or everybody is busy?
>
> I think there's a place for a StringBuilder-like
> abstraction that uses a gap buffer,
> but it shouldn't replace StringBuilder.
Let me qualify that.
It is hard to sell the small slowdown in the common case
to make other (rare?) operations much faster.
ArrayList should have been implemented to allow
O(1) insert at both ends, like ArrayDeque,
but it is hard to persuade the maintainers
that such a change is worth making today,
when the benchmarks all exercise only the common case.
Similarily for a hypothetical GapArrayList.
On the other hand, on modern cpus
arithmetic is ever closer to being "free",
so it is easier to justify the extra computation.
Martin
More information about the core-libs-dev
mailing list