notmuch: use faster, but inaccurate message count

This commit is contained in:
Bill Thiede 2024-09-28 12:28:41 -07:00
parent fbc426f218
commit a89a279764

View File

@ -518,8 +518,10 @@ impl Notmuch {
} }
pub fn count(&self, query: &str) -> Result<usize, NotmuchError> { pub fn count(&self, query: &str) -> Result<usize, NotmuchError> {
// TODO: compare speed of notmuch count for * w/ and w/o --output=threads // NOTE: --output=threads is technically more correct, but really slow
let res = self.run_notmuch(["count", "--output=threads", query])?; // TODO: find a fast thread count path
// let res = self.run_notmuch(["count", "--output=threads", query])?;
let res = self.run_notmuch(["count", query])?;
// Strip '\n' from res. // Strip '\n' from res.
let s = std::str::from_utf8(&res[..res.len() - 1])?; let s = std::str::from_utf8(&res[..res.len() - 1])?;
Ok(s.parse()?) Ok(s.parse()?)