Ryan Davis wrote: > class Array > alias_method :old_join, :join > def join(sep = $,, last_sep = sep) > return "" if empty? > > seperators = Array.new(size-1, sep) > seperators[-1] = last_sep unless seperators.empty? > self.zip(seperators).old_join > end > end > > # of iterations = 1000000 > user system total real > null_time 0.140000 0.000000 0.140000 ( 0.140482) > jeg 29.690000 0.080000 29.770000 ( 30.144816) > ryan 19.780000 0.050000 19.830000 ( 19.998077) I wonder how this would fair. class Array alias :old_join :join def join( sep=$,, last_sep=nil ) s = old_join(sep) if last_sep rsep = Regexp.escape(sep.to_s) rlast = Regexp.escape(last.to_s) s.sub!(/#{rsep}#{rlast}$/,"#{last_sep}#{last}") end return s end end Sorry, the bencmark script wasn't posted and I didn't feel like recreating it. T.