473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

High performance binary data

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?

Thanks
Steve

Aug 10 '07 #1
3 2176
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.

Ciao,
Marc 'BlackJack' Rintsch
Aug 10 '07 #2
Steve <st*********@gmail.comwrote:
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?
Check out construct: http://construct.wikispaces.com/

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Aug 10 '07 #3
On Aug 10, 2:26 am, Steve <steve.mo...@gmail.comwrote:
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 would recommend NumPy for manipulating binary data. It is primarily
intended for numerics, but it is excellent for dealing with any kind
of binary data as well. It can handle mutable buffers of any kind of
integer or float, as well as arrays of C-like structs (record arrays
in numpy). You can typecast and create subarrays without copying any
data, simply by providing a new "view" into the buffer. You can also
get access to strided subsections without creating copies. And it is
very fast.

www.scipy.org

Aug 10 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bonj | last post by:
hello this is a purely algorithmical question but if i have posted to an irrelevant group, apologies. can anyone point me at some good tutorials or info about the steps involved in creating a...
5
by: Ron Mexico | last post by:
I have written a graphing engine (very similar to what BigCharts.com offers). Basically, it's an ASPX page that accepts parameters and calls back-end business objects (dlls) to create a graph. ...
2
by: Ryan | last post by:
My apologies if this is not the forum to post questions regarding .NET Remoting, but I figured WebServices would be the most appropriate forum of the bunch. We're currently completely re-arching...
0
by: Michel Esber | last post by:
Hello, Linux RedHat AS4 running DB2 V8 FP15. I have very large tables (100 Million+ rows), and I only need to keep 6 months of data online/available. The tables have a timestamp field. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.