Optimize readline/readdelim/getdelim calls.
This speeds up common reading operations by factor of 4-6. * include/mailutils/stream.h (mu_stream_readdelim): New proto. * include/mailutils/sys/stream.h (_mu_stream) <readdelim>: New method. * mailbox/stream.c (_stream_scandelim, _stream_readdelim): New functions. (mu_stream_readdelim): New function. (mu_stream_readline): Rewrite using mu_stream_readdelim. (mu_stream_getdelim): Optimize. * mailbox/amd.c (amd_body_stream_readdelim): New function. (_amd_attach_message): Set the readdelim method. * mailbox/header.c: Add a placeholder for readdelim method. * mailbox/message.c (_message_stream_readdelim): New function. (_message_stream_create): Set the readdelim method. * mailbox/streamref.c (_streamref_readdelim): New function. (mu_streamref_create_abridged): Set the readdelim method.
Showing
7 changed files
with
235 additions
and
14 deletions
-
Please register or sign in to post a comment