[ENet-discuss] Unreliable send optimisation

Lee Salzman lsalzman at telerama.com
Wed Feb 11 05:59:45 PST 2004

Try using enet_host_flush(). This will send out any queued packets
immediately, just like calling enet_host_service would(). However, ENet
is made to send out large amounts of data, so it will try to queue up
the packets until it really needs to send them out. And further, ENet is
not concurrent, for simplicity and utility, so latency is entirely up to
you, the user, based on how often you service or flush the host.

Now, as far as I can tell, the allocation has little effect on 
performance, but I am working on some allocation callbacks 
for people who want to implement their own memory allocation.
This should be in for the 1.0 release. However, I'm fairly certain 
the memory allocation has little if any influence on ENet performance,
atleast assuming a good memory allocator like provided with GNU libc.
You're only allocating a relatively small number of objects, of pretty
much fixed sizes, which any half-decent memory allocator should be
able to handle without fragmentation and considerably fast. Pretty 
much all of the time in ENet is spent in kernel land.


On Wed, Feb 11, 2004 at 05:19:52PM +1030, Tim Auld wrote:
> When you send an unreliable message, Enet will allocate some memory, put it in the outgoing command list, and wait until an enet_host_service() call is made, right?  Is this for the benefit of throttling?  In the case where there is no throttling, waiting until an enet_host_service() call is made can cost several milliseconds in latency, not to mention some load in memory allocation and fragmentation.  A small degredation in performance has been noticed on local networks since Enet has been integrated.  Pings are generally higher, including some 10ms pings, which is unusual.  Is it possible to have an interface to send the message immediately?
> Side note: I'm not too keen on the heavy run-time memory allocation.  It would be nice to have some options for pre-allocating an array of buffers.
> Tim Auld
> Lead Programmer
> Ratbag 
> Level 8, 63 Pirie Street, Adelaide SA 5000, Australia
> Ph 08 8223 5830, Fax 08 8223 5746, Mobile 0413 660 994
> email  tim at ratbaggames.com
> Website  www.ratbaggames.com
> This email is confidential for the addresse only and is subject to
> copyright where applicable.

More information about the ENet-discuss mailing list