Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] [PATCH] cache results of Person.from_address
Date: Sat, 22 Aug 2009 07:10:04 -0700	[thread overview]
Message-ID: <1250949615-sup-1773@masanjin.net> (raw)
In-Reply-To: <1250491172-19317-1-git-send-email-rlane@club.cc.cmu.edu>

This looks good. Two minor questions before I apply:

Reformatted excerpts from Rich Lane's message of 2009-08-16:
> The regexes in this function are very expensive, so caching improves
> performance significantly for queries and slightly for indexing.

When you say this affects query performance, is it just the contact-list
query, or is there some other mechanism by which this is slowing down
regular queries?

Also in this method:

> +  def []=(k,v)
> +    if @values.size < @n
> +      @values[k] = v
> +      @marks[k] = @i
> +    else
> +      if @delete_stack.empty?
> +        sweep
> +      else
> +        k2 = @delete_stack.pop
> +        @values.delete k2
> +        @marks.delete k2
> +        self[k] = v
> +      end
> +    end
> +  end

Wouldn't it be better to do this?

       else
         if @delete_stack.empty?
           sweep
         end

         unless @delete_stack.empty?
           k2 = @delete_stack.pop
           @values.delete k2
           @marks.delete k2
           self[k] = v
         end

So we check the delete stack even after calling sweep, and we allow for
the value to be nil.

Thanks!
-- 
William <wmorgan-sup at masanjin.net>


  parent reply	other threads:[~2009-08-22 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-17  6:39 Rich Lane
2009-08-17 13:07 ` Andrei Thorp
2009-08-22 14:10   ` William Morgan
2009-08-22 14:10 ` William Morgan [this message]
2009-08-22 18:28   ` Rich Lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250949615-sup-1773@masanjin.net \
    --to=wmorgan-sup@masanjin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox