Another 10% query performance boost.
---
 lib/sup/xapian_index.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
index c260728..3a23951 100644
--- a/lib/sup/xapian_index.rb
+++ b/lib/sup/xapian_index.rb
@@ -74,7 +74,7 @@ class XapianIndex < BaseIndex
     m = Message.new :source => source, :source_info => entry[:source_info],
                     :labels => entry[:labels], :snippet => entry[:snippet]
 
-    mk_person = lambda { |x| Person.new(*x.reverse!) }
+    mk_person = lambda { |x| QuickPerson.new(*x) }
     entry[:from] = mk_person[entry[:from]]
     entry[:to].map!(&mk_person)
     entry[:cc].map!(&mk_person)
@@ -84,6 +84,14 @@ class XapianIndex < BaseIndex
     m
   end
 
+  class QuickPerson < Person
+    def initialize email, name
+      raise ArgumentError, "email can't be nil" unless email
+      @email = email
+      @name = name
+    end
+  end
+
   def add_message m; sync_message m end
   def update_message m; sync_message m end
   def update_message_state m; sync_message m end
-- 
1.6.4

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to