mu-document: Make sexp() lazy (optimization)
This makes queries where we don't need the sexp much faster; e.g. before: mu find "a" --include-related 47,51s user 2,68s system 99% cpu 50,651 total after: mu find "a" --include-related 7,12s user 1,97s system 87% cpu 10,363 total
This commit is contained in:
@ -38,7 +38,7 @@ const Xapian::Document&
|
||||
Document::xapian_document() const
|
||||
{
|
||||
if (dirty_sexp_) {
|
||||
xdoc_.set_data(sexp_.to_string());
|
||||
xdoc_.set_data(sexp().to_string());
|
||||
dirty_sexp_ = false;
|
||||
}
|
||||
return xdoc_;
|
||||
@ -47,7 +47,7 @@ Document::xapian_document() const
|
||||
template<typename SexpType> void
|
||||
Document::put_prop(const std::string& pname, SexpType&& val)
|
||||
{
|
||||
sexp_.put_props(pname, std::forward<SexpType>(val));
|
||||
cached_sexp().put_props(pname, std::forward<SexpType>(val));
|
||||
dirty_sexp_ = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user