Re: Direct Copying To Share Memory In NDIS ProtocolReceive

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Don,

Now, on huge transfers (things like 4MB packets and 20 or more of those a
second) it can make a difference,

Actually, I am not sure that frequency of data transfers is that important
here - you will, apparently, proceed to data transfer from device to memory
only after making sure that the previous one has been "consumed" by the app,
i.e., again, no matter how you look at it, every transfer will involve calls
to synchronization functions by an application.

The buffer size may be important if the buffer is so huge that you are not
sure that you will always be able to find contigious address space to hold it.
In this case you can split it into separate buffers, and send addresses of
these buffers to the driver. You driver will build MDLs that describes each
buffer, and then
chain all these MDLs together into a single MDL that it will use for
subsequent data transfers. In such case you will, indeed, get an improvement
- instead of N IO operations for each buffer, you will have to do only one
(apparently, you will have to do it via DeviceIoControl(), rather than
ReadFileEx()).

However, if the buffer is contigious, it just does not make sense to share
it, because
in such case you will be able to accomplish data transfer in one
ReadFileEx() call anyway..

Anton Bassov

"Don Burn" wrote:


"Le Chaud Lapin" <jaibuduvin@xxxxxxxxx> wrote in message
If I was in the OP's place, if would first try to do everything "stupid
and
simple", and see how it all works - I wold start thinking about
optimization
if and only if I am not happy with the performance. However, the OP
starts
thinking about it in the very beginning of his project.

That is the way I work. I think about the end result, then spend much
time thinking about how I can get there without doing anything. I
mull, which is what I am doing now.

According to Knuth, " in 95% of cases optimization is mother of all
evil". I
think that there is a good chance that the OP's case falls into these
95%

Actually, I believe Knuth said "Premature optimization is the root of
all evil." In this case, the optimization is not premature, any more
than considerations of optimization would be premature in the design
of a hash-based associative set. The whole reason for even considering
the design I had in mind was optimization. So in this case, my form
is driven by optimization. If the goal where simply to receive and
transmit packets, I would have just done that.

But you are right, I definitely should consider whether it is worth
deviating from something "normal", which is why I was trying to get an
indication of how much performance increase I could expect on packet
receive indications.

Well all I can say is for small transfers like packet size data, I have
never seen an increase for anyone who has played these games. I have seen
a decrease in most cases of 10 to 30 percent or more, since they have
overhead on keeping track of things that overrides the improvements.

Now, on huge transfers (things like 4MB packets and 20 or more of those a
second) it can make a difference, but network traffic doesn't make that
model.

Personally, I believe Anton's advice is absolutely correct, do it simple
and clean. Then you can experiment, remember even if it is faster, unless
it is significant you have to trade that off against the likely decrease in
reliability you are creating for the system.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply



.



Relevant Pages

  • Re: Buffering
    ... time does relate to one-way data transfers. ... When I pull some video ... buffer the whole thing at once. ... Video, like audio, requires a constant rate in order to be ...
    (microsoft.public.windowsxp.general)
  • Re: [Lit.] Buffer overruns
    ... >>determining whether a program has a buffer overflow. ... > you get around undecidability is almost always the same; ... > optimization is undecidable; nonetheless, a good optimizer will only apply ... So maybe there's a useful subset of C that can be accurately ...
    (sci.crypt)
  • Re: Direct Copying To Share Memory In NDIS ProtocolReceive
    ... WaitXXX() functions that involve user-to-kernel transition before they can ... access the buffer. ... and see how it all works - I wold start thinking about optimization ...
    (microsoft.public.development.device.drivers)
  • Re: Is there a STL equivalent of sprintf
    ... number of conversions. ... Have you considered ostrstream or istrstream with a fixed size buffer? ... I've played around with various optimization before and I think I've tested fix buffers too. ... Since sprintf is used internally in stringstreams I don't see a performance advantage to prefer the stream library for string conversion of integers. ...
    (microsoft.public.vc.stl)
  • Re: Performance of lists vs. list comprehensions
    ... buffer after its last expansion and no saved tuple). ... As near as I can determine, the CPython optimization you are referring to ... The optimization patch is here: ... algorithm is, ...
    (comp.lang.python)