From: Florian Frank Date: 2007-09-29T03:27:12+09:00 Subject: Re: Ruby performance Christoffer Lernæ—¦ wrote: > Weird. The python version extremely slow compared to Kirk's ruby > version. Does it suffer from the same allocation problems as the > initial ruby version? Yes, for a + b python allocates a new string of length(a) + length(b), then a's and b's content are copied into the new string. There is only an optimization if a or b is empty. a << b in ruby first reallocates memory of length(b) to a's then copies only b's content to a. If b is empty ruby does nothing. The more complex concatenation operation in python is caused by python's immutable strings. -- Florian Frank