X Tutup
The Wayback Machine - https://web.archive.org/web/20210106130637/https://github.com/python-xlib/python-xlib/pull/85
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

Fix encode/decode errors in structs. #85

Closed
wants to merge 2 commits into from

Conversation

@cykerway
Copy link

@cykerway cykerway commented Sep 3, 2017

The default encoding in Python 3 is 'utf-8', which is not a good choice
for byte-level data pack/unpack because it uses multiple bytes for code
point >= 128.

This commit changes encoding being used to 'latin-1', which covers all
possible code points in range (0-255) with a simple one-to-one mapping.

This commit has fixed some UnicodeDecodeError in practice.

The default encoding in Python 3 is 'utf-8', which is not a good choice
for byte-level data pack/unpack because it uses multiple bytes for code
point >= 128.

This commit changes encoding being used to 'latin-1', which covers all
possible code points in range (0-255) with a simple one-to-one mapping.

This commit has fixed some *UnicodeDecodeError* in practice.
@codecov-io
Copy link

@codecov-io codecov-io commented Sep 3, 2017

Codecov Report

Merging #85 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master      #85   +/-   ##
=======================================
  Coverage   81.25%   81.25%           
=======================================
  Files          39       39           
  Lines        4427     4427           
=======================================
  Hits         3597     3597           
  Misses        830      830
The `send_and_recv` function is very slow on receiving a large volume of
data because it only receives 2048 bytes at a time and keeps appending
these small chunks of data into a large array.

This commit sets the recv buffer to a larger value. This has provable
performance benefits: The running time of a Xlib program has been
reduced from 12 seconds to 0.5 seconds, a 24x speedup.
@benoit-pierre
Copy link
Member

@benoit-pierre benoit-pierre commented Sep 3, 2017

Closing this, for rational see: #84 (comment)

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.
X Tutup