Skip to content

Optimize struct unpacking #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tannewt opened this issue Oct 2, 2017 · 2 comments
Closed

Optimize struct unpacking #7

tannewt opened this issue Oct 2, 2017 · 2 comments

Comments

@tannewt
Copy link
Member

tannewt commented Oct 2, 2017

x = struct.unpack('<h', data[0:2])[0]
y = struct.unpack('<h', data[2:4])[0]
z = struct.unpack('<h', data[4:6])[0]

Slicing data causes an extra allocation. Struct should be able to take the whole buffer and split out the values at once.

@mrmcwethy
Copy link
Collaborator

I have a fix to Adafruit_Circuitpython_LIS3DH issue #7 Optimize struct unpacking in my development env. Can someone assign it to me or allow me contributor rights?

@mrmcwethy
Copy link
Collaborator

This issue is fixed as of oct 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants