P
Paul Hsieh
Rarely it makes sense to have adjustable buffer sizes. But only rarely.
Every object created by the Better String Library is resizable.
[...] A
theoretical result is that you _can_ perform any computation with just a
disk file and a finite list of states, but generally if a small amount of
memory is not made available, you might as well forget about the operation.
Interesting choice.
So I was making an application that downloaded a massive stream from
the internet that *far* exceeded the memory of my system. The
information came down in small chunks, but processing them one chunk
at a time was way too much overhead, especially since many of these
chunks are linked together. The idea of simply sucking down as much
as could be fit into a single bstring until I ran out of memory, then
processing what I've got before getting more stuff appealed so much to
me I actually coded it up. It works, I max my internet connection, my
CPU and my total memory all at the same time. And of course the
application runs as fast as I know how to make it.
Without a "run until you run out of memory" scheme, I would have had
to tune some fixed amount of space to be both fast and reasonable on
whatever machine architecture, and basically lose a little on
performance, and fail on certain machines with too little memory. But
simply scaling to the amount of memory that's actually available on a
machine the program just works.
You've instantly doubled you development costs by insisting on this.
The development cost for *using* Bstrlib is about 15 minutes to
download, install, try a few examples, and basically understand it.
It did take me a while to develop it, but that's only because people
before just didn't quite have the insight to see the importance of
implementing Bstrlib the way it is. And of course, its development
time invested is amortized for all future projects I make that use
Bstrlib.
I have other libraries for data structures that are basically the
same. And you are right that development cost is increased (that's C
for you), but its not doubled.