Skip to content
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

unpack_from is faster than unpack of slice #3201

Merged
merged 1 commit into from Jun 30, 2018
Merged

unpack_from is faster than unpack of slice #3201

merged 1 commit into from Jun 30, 2018

Conversation

landfillbaby
Copy link
Contributor

@landfillbaby landfillbaby commented Jun 23, 2018

tiny bit faster
struct.unpack_from just doesn't read the memory further if input data is too long, so slice stops were unneeded
for non-zero slice starts, struct.unpack_from just adds to the memory offset instead of copying like slices
(was 2 commits, rebased to 1 after changing 3 more files)

@landfillbaby landfillbaby changed the title _binary.py: unpack_from instead of unpack + slice remove unnecessary slices in struct.unpack calls Jun 24, 2018
@landfillbaby landfillbaby changed the title remove unnecessary slices in struct.unpack calls remove unnecessary slices in struct.unpack calls by using struct.unpack_from Jun 24, 2018
@landfillbaby landfillbaby changed the title remove unnecessary slices in struct.unpack calls by using struct.unpack_from unpack_from is faster than unpack of slice Jun 24, 2018
@hugovk hugovk merged commit 2be5c03 into python-pillow:master Jun 30, 2018
@landfillbaby landfillbaby deleted the patch-1 branch June 30, 2018 20:14
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

Successfully merging this pull request may close these issues.

None yet

3 participants