Re: Efficient scather-gather-copy
- From: Hynek Schlawack <spamtrap@xxxxxxxxxx>
- Date: Fri, 14 Apr 2006 00:53:07 +0200
"Mark Whitlock" <spamtrap@xxxxxxxxxx> writes:
I'm in the unlucky situation to convert mails from theYou shod probably just run these through a filter program. What
"\n"-lineendings to "\r\n"-ones.
OS are you using ?
It's UNIX and yet filtering is simply too slow. I'd rather use memcpy()
than external programs.
If I'm not mistaken, I have to count the lines, allocHow about opening 2 files ,one for input ,one for output.
sizeof(mail)+num_of_lines(mail), copy each line seperately with a space
between them to the buffer and replace the "\n" through "\r\n".
Read the input ,if it is not a newline ,write it to the output.
If it is a newline ,write return ,then newline to the output.
Well, I'm getting it as a buffer and anything that remotely could
involve access to file systems is out of question.
Imagine dozens of mails per _second_ that want to be
processed. Probably, memcpy() might be fast enough on a decent machine,
however it would definitely be a bottleneck. So I want to make it really
as fast a possible, as there isn't unfortunately much I can optimize
algorithm-sided.
This should stream pretty fast.
probably missing something,
Only, that "pretty fast" ain't "fast enough" in this case. ;)
Thanks for your reply,
-hs
.
- Follow-Ups:
- Re: Efficient scather-gather-copy
- From: Tim Roberts
- Re: Efficient scather-gather-copy
- From: spamtrap
- Re: Efficient scather-gather-copy
- From: Robert Redelmeier
- Re: Efficient scather-gather-copy
- References:
- Efficient scather-gather-copy
- From: Hynek Schlawack
- Re: Efficient scather-gather-copy
- From: Mark Whitlock
- Efficient scather-gather-copy
- Prev by Date: GetPrivateProfileInt help
- Next by Date: read-for-ownership and write allocate.
- Previous by thread: Re: Efficient scather-gather-copy
- Next by thread: Re: Efficient scather-gather-copy
- Index(es):
Relevant Pages
|