guile-email discussion
 help / color / mirror / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guile-email@systemreboot.net
Subject: Re: [guile-email] slow parse of email with huge attachment
Date: Mon, 25 May 2020 20:22:54 +0530	[thread overview]
Message-ID: <cu7a71wf4mx.fsf@systemreboot.net> (raw)
Message-ID: <20200525145254.l3XSSRnYw4h_oOob2uLJKhrrKRvkuHL62BmyOjEv2y0@z> (raw)
In-Reply-To: <87y2ppezni.fsf@elephly.net>

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]


Hi,

I've made some improvements. I got the following snippet down from
around 16s to 6s.

--8<---------------cut here---------------start------------->8---
(statprof (lambda ()
            (map parse-email
                 (call-with-input-file "large-base64-attachment.mbox"
                   mbox->emails))))
--8<---------------cut here---------------end--------------->8---

Specifically, I made the following improvements to guile-email.

- I rewrote the base64 decoder from scratch to be a little
  faster. Earlier, I was using the decoder I had copied from Guix.
- I eliminated several unneccessary bytevector<->string conversions.
- I rewrote read-bytes-till in (email utils) to process multiple bytes
  at a time, instead of byte by byte.

There is still scope for improvement, but do test and let me know if
this serves your purpose for now. Also, I am curious to see your new
benchmark of parse-email to compare with the 8s you reported earlier.

Cheers!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  parent reply	other threads:[~2020-05-25 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 22:06 Ricardo Wurmus
2020-05-18  1:13 ` Arun Isaac
2020-05-18  1:13   ` Arun Isaac
2020-05-18 20:50   ` Ricardo Wurmus
2020-05-19  2:33     ` Arun Isaac
2020-05-19  2:33       ` Arun Isaac
2020-05-25 14:52     ` Arun Isaac [this message]
2020-05-25 14:52       ` Arun Isaac
2020-05-25 15:08       ` Arun Isaac
2020-05-25 15:08         ` Arun Isaac

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=cu7a71wf4mx.fsf@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=guile-email@systemreboot.net \
    --cc=rekado@elephly.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