summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/tests/walktree.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-20 02:52:17 -0400
committerKali Kaneko <kali@leap.se>2014-02-20 16:17:25 -0400
commitb2d97c9faef6037a065e2903afe5b0ab2624917e (patch)
tree268a86e5a668e604bfa8907a8d0f4a7025819238 /src/leap/mail/imap/tests/walktree.py
parent66c5602b77547ec24674f5e40c1d244f28ff5a49 (diff)
mail parsing performance improvements
Although the do_parse function is deferred to threads, we were actually waiting till its return to fire the callback of the deferred, and hence the "append ok" was being delayed. During massive appends, this was a tight loop contributing as much as 35 msec, of a total of 100 msec average. Several ineficiencies are addressed here: * use pycryptopp hash functions. * avoiding function calling overhead. * avoid duplicate call to message.as_string * make use of the string size caching capabilities. * avoiding the mail Parser initialization/method call completely, in favor of the module helper to get the object from string. Overall, these changes cut parsing to 50% of the initial timing by my measurements with line_profiler, YMMV.
Diffstat (limited to 'src/leap/mail/imap/tests/walktree.py')
-rw-r--r--src/leap/mail/imap/tests/walktree.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/leap/mail/imap/tests/walktree.py b/src/leap/mail/imap/tests/walktree.py
index f3cbcb0..695f487 100644
--- a/src/leap/mail/imap/tests/walktree.py
+++ b/src/leap/mail/imap/tests/walktree.py
@@ -36,11 +36,11 @@ p = parser.Parser()
if len(sys.argv) > 1:
FILENAME = sys.argv[1]
else:
- FILENAME = "rfc822.multi-minimal.message"
+ FILENAME = "rfc822.multi-signed.message"
"""
-FILENAME = "rfc822.multi-signed.message"
FILENAME = "rfc822.plain.message"
+FILENAME = "rfc822.multi-minimal.message"
"""
msg = p.parse(open(FILENAME))