High performance binary data

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Aug 10 07:49:04 CEST 2007

On Fri, 10 Aug 2007 00:26:54 +0000, Steve wrote:

> I want to ready binary data from a udp socket effeciently as possible
> in python.  I know of the struct package but do people have any tips
> when dealing with binary data in python?  Is there a library or api
> that is faster when dealing with binary data. I am looking for a any
> one with experience or ideas on the subject.  Pointers any one?

I don't know if it is faster, but maybe constructing objects with
the `ctypes` module let you write more readable code as you can treat and
access C ``struct``\s like objects.

For the "fast" part of the question you might consider actually measuring
your program, as the task may be I/O bound i.e. Python may be faster than
the data comes in regardless of which module, `struct` or `ctypes`, you
use to tear apart and access the data.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list