Closed frasertweedale closed 6 years ago
@romanofski yo, just a heads up to keep you in the loop on hs-notmuch. Feel free to eyeball this change and ask about stuff if you have questions. I have some other optimisations in the pipeline too. The main thing I need is just for you to make sure I don't break purebred or regress on performance in some use case I haven't tested.
I gave it a go today and couldn't find any problems with it. Great explanation btw on the commit message. Like it 👍
This PR contains a series of commits that optimise iteration. In particular
avoid use of
ForeignPtr
for iteratingnotmuch_tags_t
. This improves memory usage when reading tags on lots of messages.lazily read message and thread iterators (
notmuch_(thread|message)s_t
). This defers each read of the iterator until its value is demanded. This reduces maximum memory usage when processing long lists (earlier parts can be GC'd) and avoids computation/allocation for parts of the list that are never demanded.