>>>>> ">" == C Scott Ananian <[EMAIL PROTECTED]> writes:
>> however, the "constant factor" implementation has the advantage of
>> provable O(lg n) time regardless of the size 'n' of the buffer.
I don't catch your meaning. Can you explain?
Regardless, it seems to me that in this particular case the existing
Classpath code is clearly less efficient. For instance if you call
write() with an argument which is longer than the constant resize
factor, then it will happily enlarge the buffer `size % factor' times
-- each such resize involving an allocation and a copy of the buffer
contents.
The libgcj implementation guarantees both at most a single copy
operation per write, as well as nice asymptotic behavior.
Yes, the Classpath problem could be fixed in an other way. But since
I generally merge anyway when I look at a class, in this case it was
easier to merge from libgcj than to spend any time on the Classpath
class.
Tom