LINUX.ORG.RU

История изменений

Исправление special-k, (текущая версия) :

1.9.3-p194 :041 > def a
1.9.3-p194 :042?>   yield
1.9.3-p194 :043?>   end
 => nil 
1.9.3-p194 :047 > def b &block
1.9.3-p194 :048?>   block.call
1.9.3-p194 :049?>   end
 => nil 
1.9.3-p194 :050 > t=Time.now;10000.times{a{}};Time.now-t
 => 0.002899452
1.9.3-p194 :051 > t=Time.now;10000.times{b{}};Time.now-t
 => 0.024449555 

Вот я о чем.

Исправление special-k, :

1.9.3-p194 :041 > def a
1.9.3-p194 :042?>   yield
1.9.3-p194 :043?>   end
 => nil 
1.9.3-p194 :047 > def b &block
1.9.3-p194 :048?>   block.call
1.9.3-p194 :049?>   end
 => nil 
1.9.3-p194 :050 > t=Time.now;10000.times{b{}};Time.now-t
 => 0.024449555 
1.9.3-p194 :051 > t=Time.now;10000.times{a{}};Time.now-t
 => 0.002899452

Вот я о чем.

Исходная версия special-k, :

1.9.3-p194 :041 > def a
1.9.3-p194 :042?>   yield
1.9.3-p194 :043?>   end
 => nil 
1.9.3-p194 :047 > def b &block
1.9.3-p194 :048?>   block.call
1.9.3-p194 :049?>   end
 => nil 
1.9.3-p194 :050 > t=Time.now;10000.times{b{}};Time.now-t
 => 0.024449555 
1.9.3-p194 :051 > t=Time.now;10000.times{a{}};Time.now-t
 => 0.002899452