mu-server: use strings, not sexps object (optimization)

When passing messages to mu, often we got a (parsed from string)
message-sexp from the message document; then appended some more
properties ("build_message_sexp").

Instead, we can do it in terms of the strings; this is _a little_
inelegant, but also much faster; compare:

(base)
[mu4e] Found 500 matching messages; 0 hidden; search: 1298.0 ms (2.60 ms/msg); render: 642.1 ms (1.28 ms/msg)

(with temp-file optimization (earlier commit)
[mu4e] Found 500 matching messages; 0 hidden; search: 1152.7 ms (2.31 ms/msg); render: 270.1 ms (0.54 ms/msg)

(with temp file optimize _and_ the string opt (this commit)
[mu4e] Found 500 matching messages; 0 hidden; search: 266.0 ms (0.53 ms/msg); render: 199.7 ms (0.40 ms/msg)
This commit is contained in:
Dirk-Jan C. Binnema
2023-07-31 23:53:29 +03:00
parent 1018f0f0a1
commit aea95b5be0
4 changed files with 137 additions and 118 deletions

View File

@ -144,13 +144,19 @@ public:
void remove(Field::Id field_id);
/**
* Get the cached s-expression useful for changing
* it (call update_sexp_cache() when done)
* Get the cached s-expression
*
* @return the cached s-expression
*/
const Sexp& sexp() const { return cached_sexp(); }
/**
* Get the message s-expression as a string
*
* @return message s-expression string
*/
std::string sexp_str() const { return xdoc_.get_data(); }
/**
* Generically adds an optional value, if set, to the document
*