[Exim] message_body efficiency hack

Top Page
Delete this message
Reply to this message
Author: Nigel Metheringham
Date:  
To: Exim
Subject: [Exim] message_body efficiency hack
I am proposing the following change to the implementation of
message_body and message_body_end (this will not affect its use, just
the internals):-

1. During message receipt message_body & message_body_end are built
up from the message stream. [this might actually be difficult for
message_body_end but I'll find a way of doing it.

2. message_body & message_body_end are saved as variables in the header
file (like body_linecount etc)

3. The variables will be recreated/loaded on message header read
and will so be available without an additional read on the body file.

Cost of this is that the header file gets bigger by around 2 *
message_body_visible which I guess just might be an issue - especially
for people who set that up to 64K :-)

The bigger file will cause a marginal (I think) cost of read on all
message processing, the advantage of this being that in the majority of
cases it will not cost an extra read should you use message_body
anywhere.

I guess I am creating a slight hit in all cases to cover the fewer
cases where this is really useful (however when you need it you
*really* need it).

The current implementation is that message_body accesses *each* force a
seek/read of the body file. On some OSes that may blow your caching of
that file, and is certainly not good.

[An alternative implementation I could do is to build the variables as
in (1), and change the read functions to cache/use-cached copies rather
than rebuild every time - this has a few more issues in terms of making
sure that the life time of the cached variables is right]

Thoughts?

    Nigel.
-- 
[ - Opinions expressed are personal and may not be shared by VData - ]
[ Nigel Metheringham                  Nigel.Metheringham@??? ]
[ Phone: +44 1423 850000                         Fax +44 1423 858866 ]