purebred-mua / hs-notmuch

Modern Haskell binding to the Notmuch mail indexer
11 stars 2 forks source link

remove bad optimisation suggestion #29

Closed frasertweedale closed 6 years ago

frasertweedale commented 6 years ago

I have now measured the proposed optimisation of stealing a string pointer with talloc_steal and finalising it with talloc_free, instead of allocating and copying a new ByteString.

The good news is that the suggested optimisation works.

The bad news is that it isn't really an optimisation unless the strings are quite a bit longer than the overhead of a ForeignPtr. In our use case (tags, header values, filenames) this is not the case. I have profiled the approach with hs-notmuch-tags-count and found:

Overall it seems not to be worth it.