From de6b5dd5ffff6e21064f78f24c30c59e391ff370 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 11 Feb 2010 22:15:29 -0800 Subject: use Hash#compare_by_identity for performance When available (Ruby 1.9), we can use Hash#compare_by_identity to improve performance. --- lib/rainbows/fiber/base.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/rainbows/fiber') diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index 090a9e4..c65b07b 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -5,13 +5,13 @@ module Rainbows module Fiber # blocked readers (key: Rainbows::Fiber::IO object, value is irrelevant) - RD = {} + RD = {}.compare_by_identity # blocked writers (key: Rainbows::Fiber::IO object, value is irrelevant) - WR = {} + WR = {}.compare_by_identity # sleeping fibers go here (key: Fiber object, value: wakeup time) - ZZ = {} + ZZ = {}.compare_by_identity # puts the current Fiber into uninterruptible sleep for at least # +seconds+. Unlike Kernel#sleep, this it is not possible to sleep -- cgit v1.2.3-24-ge0c7