I am trying to speed up my script. It basically reads a pcap file with Velodyne\'s Lidar HDL-32 information and allows me to get X, Y, Z, and Intensity values. I have profiled m
For your specific situation if you can fit your loop into a numpy call, that'd be fastest.
With that said, for just the struct.unpack
part -- if your data happens to native byte order, you can use memoryview.cast
. For a short
example, it is about 3x faster than naive struct.unpack
without any change in logic.
In [20]: st = struct.Struct("