From: Robert Klemme Date: 2013-03-19T22:01:24+09:00 Subject: Re: Algorithmic complexity On Tue, Mar 19, 2013 at 10:39 AM, Rotar D. wrote: > Can anyone tell algorithmic complexity for this operation: > > v.attributes.map{ |k, val| {k => info.instance_values[k]} > }.reduce(:merge).each_pair{ |key, value| > v.send( (key + '=').to_sym, value) } Can you tell us what these variables reference? v info Btw, algorithmic complexity might not be the critical factor. For example: you seem to create a lot of single entry Hashes and then merge them. It would certainly be more efficient to just create a single Hash and update that. Or wait, I don't think you need a Hash at all. If all types are what I think you can probably get away with v.attributes.each do |k| v.send "#{k}=", info.instance_values[k] end Which is much simpler and should be more efficient, too. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/