Re: Please Explain the Speed Difference here.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Are you passing file names around or just data? I don't see why you should
need to keep intermediate temporary data in files. If you're running on x64
(why you should not?), you get quite a lot of virtual address space. You
could just allocate memory instead of temporary files. How often at email
takes more than 10-20 MB? If you still need a file, though, open it with
FILE_ATTRIBUTE_TEMPORARY.

If you don't know the message size ahead, keep it in memory until it exceeds
some threshold, then engage a temporary file.

"Tommy" <bad@xxxxxxxxxxxxx> wrote in message
news:%23pEv$ILWJHA.3908@xxxxxxxxxxxxxxxxxxxxxxx
FYI Background.

This is a POP3 Server (a TCP/IP server to users, a RPC client to the RPC
server). The issue is that the POP3 specification requires the EXACT
length each message.

So when the email is pulled from the RPC Server database:

char *srcfn = "wc:\\mail\\email_referenced_by_id";
char *tarfn = ".\\workspace\emailid.dat";

WCHANDLE hsrc = wcCreateFile(srcfn,,,);
HANDLE htar = CreateFile(tarfn,,,);

The temp file has to be "massaged" to make sure it is in RFC 2822 format
and also escapes dots ('.') that begin on a line. It is escaped to double
dots because the message block ends with a single dot, <crlf>.<crlf> The
results is appended to a POP3CACHE.DAT. This is the DoSomething() in:

WcCopyFile(src,tar)
...DoSomething(), Massage, Append Pop3Cache.dat...
Deletefile(tar)

hence the final DeleteFile(tar).

So when I began this, offhand, I thought considered the bottleneck was
within two place:

WcCopyFile()
DoSomething()

to my surprise DoSomething() was no factor as far as total performance.
The profiling showed the WcCopyFile() is where most of the time was chewed
up.

I did think the DISK HEAD as jumping all over the place, so my test case,
I removed DoSomething(). No difference.

Thats when I noticed adding a DeleteFile() before the copy made the copy
process worst. I replaced our wcCopyFile() to a simple Copyfile()
example and the same issue was seen.




.



Relevant Pages