On Fri, Jun 13, 2003 at 09:11:30PM +0900, Dominik Werder wrote: > What is the fastest way to add many small Strings to a big buffer? AFAIK, if you stay w/ Ruby (and don't write extensions in C), the best thing you can do is probably buffer << str You might want to see what speed you get if you create the buffer and then replace its contents with #[]=. That way you avoid the realloc()s, but I'm not sure it's worth it. Whatever, never use += in a loop, you'd be creating lots of garbage of increasing sizes, and copying all the time the data! It'd be nice if there was a way to create a string with an arbitrary capa, say, exposing rb_str_buf_new to the Ruby side. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Q: What's the big deal about rm, I have been deleting stuff for years? And never lost anything.. oops! A: ... -- From the Frequently Unasked Questions