From mboxrd@z Thu Jan 1 00:00:00 1970 From: rlane@club.cc.cmu.edu (Rich Lane) Date: Sat, 22 Aug 2009 14:28:39 -0400 Subject: [sup-talk] [PATCH] cache results of Person.from_address In-Reply-To: <1250949615-sup-1773@masanjin.net> References: <1250491172-19317-1-git-send-email-rlane@club.cc.cmu.edu> <1250949615-sup-1773@masanjin.net> Message-ID: <1250964897-sup-2990@zyrg.net> Excerpts from William Morgan's message of Sat Aug 22 10:10:04 -0400 2009: > 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? Actually, your question prompted me to wonder why we're calling Person.from_address on this path at all. With a little support from Message we can completely avoid Message#parse_header. I've just sent in a patch that does this. Please apply that rather than the from_address cache. The performance improvement from the new patch is slightly better than that of the cache. Depending on the benchmark I see the time taken by ThreadIndexMode#load_n_threads decrease by 1/2 to 2/3.