[interfacekit] Re: BSession(NG)

"Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:

> Adi Oanca <e2joseph@xxxxxxxxxx> wrote:
> >> Also, never split the message into two port calls.
> > No. I'm sorry, I will never agree with you on this one!
> 
> Can you elaborate a bit on why you don't do that?
> Doing 2 port writes of 1024 should be slower than doing 1 write of 
> 2048, no matter if you need to allocate the memory (or part of it) 
> first - and the problem should get worse the more parts the message 
> will have.
Right, if you have a message that is larger than 1024 bytes,
you better chose 2048 or 4096 as static maximum chunk size.
Splitting and merging messages isn't a very good way.
If you really want to implement all the overhead of splitting and
merging messages, you better allocate a shared ring buffer in
memory, and avoid all the read_port/write_port calls.
This shouldn't be more complex then having the split/merge.

> The only upside that I can see is on low memory situations, where you 
> cannot afford to allocate another 1024 bytes - but that seems very 
> unlikely.
Except if you install my ethernet driver, which will allocate a 1.5 MB chunk
as send/revceive buffer :p

Marcus


Other related posts: