Permalink
Browse files

Revert "when checking for pubsub use a Set and O(1) #member? instead …

…of O(n) #include? on an Array"

It such a micro-optimization that I don't think it justifies the loading of 'set' (https://gist.github.com/935775)

This reverts commit c1d45f3.
  • Loading branch information...
1 parent ae0aeb0 commit f5ed102f423a14ef71ed9b86b456f7915c0705e9 @mloughran committed May 3, 2011
Showing with 2 additions and 4 deletions.
  1. +0 −2 lib/em-hiredis.rb
  2. +2 −2 lib/em-hiredis/client.rb
View
2 lib/em-hiredis.rb
@@ -1,6 +1,4 @@
require 'eventmachine'
-
-require 'set'
require 'uri'
module EventMachine
View
4 lib/em-hiredis/client.rb
@@ -1,6 +1,6 @@
module EventMachine::Hiredis
class Client
- PUBSUB_MESSAGES = Set.new(["message", "pmessage"])
+ PUBSUB_MESSAGES = %w{message pmessage}.freeze
include EventMachine::Hiredis::EventEmitter
include EM::Deferrable
@@ -54,7 +54,7 @@ def connect
deferred = @defs.shift
deferred.fail(reply) if deferred
else
- if reply && PUBSUB_MESSAGES.member?(reply[0]) # reply can be nil
+ if reply && PUBSUB_MESSAGES.include?(reply[0]) # reply can be nil
kind, subscription, d1, d2 = *reply
case kind.to_sym

0 comments on commit f5ed102

Please sign in to comment.