Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] [PATCH] Show unread message count in thread index
Date: Wed, 07 Nov 2007 15:12:03 -0800	[thread overview]
Message-ID: <1194476394-sup-4617@south> (raw)
In-Reply-To: <1194469570-sup-4239@tomsk>

Excerpts from Marcus Williams's message of Wed Nov 07 13:09:10 -0800 2007:
> Is there any way to get the new message count without search for
> unread labels?

Nope. Unread is just another label, so you've got to do the search.

> How fast is that in ferret?

Pretty fast!

  $ sh devel/console.sh
  [Wed Nov 07 15:03:42 -0800 2007] loading index...
  [Wed Nov 07 15:03:42 -0800 2007] loaded index of 65765 messages
  >> require 'benchmark'
  >> all = "+label:unread -label:deleted -label:killed -label:spam"
  >> inbox = all + " +label:inbox"
  >> puts Benchmark.measure { Index.ferret.search(all).total_hits }
    0.020000   0.000000   0.020000 (  0.015534)
  >> Index.ferret.search(all).total_hits
  => 57551
  >> puts Benchmark.measure { Index.ferret.search(inbox).total_hits }
  => nil
  >> Index.ferret.search(inbox).total_hits
  => 13

The number in parentheses is elapsed real time. Probably fast enough to
call on every keypress, but feel free to cache it if you like.

> What happens if your result set has 60k messages in it, does it chew
> memory?

Nope. Play around with the methods above. Ferret is pretty good about
this.

> I cant imagine having 60k new messages, but on initial sup-sync you
> might on a big mailbox.

As you can see above, 57k of the 66k messages in my index are new.
(It's the last few years of ruby-talk.) Have I blown your mind? :)


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


  reply	other threads:[~2007-11-07 23:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 10:01 Colin Bell
2007-11-07  2:09 ` William Morgan
2007-11-07  3:55   ` Colin Bell
2007-11-07 10:29   ` Colin Bell
2007-11-07 20:08     ` William Morgan
2007-11-07 21:09       ` Marcus Williams
2007-11-07 23:12         ` William Morgan [this message]
2007-11-08  8:31           ` Marcus Williams

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=1194476394-sup-4617@south \
    --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