Skip to content

Commit

Permalink
#708: use buffering for open() only on Python 2; on Python 3 this doe…
Browse files Browse the repository at this point in the history
…s not have any effect so it's better to let python decide what to do
  • Loading branch information
giampaolo committed Dec 1, 2015
1 parent 6d2d20f commit 1152f96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
3.3.1 - XXXX-XX-XX
==================

**Bug fixes**
**Enhancements**

- #714: [OpenBSD] virtual_memory().cached value was always set to 0.
- #708: [Linux] psutil.net_connections() and Process.connections() on Python 2
can be up to 3x faster in case of many connections.
Also psutil.Process.memory_maps() is slightly faster.

**Enhancements**
**Bug fixes**

- 708: [Linux] psutil.net_connections() and Process.connections() can be up to
3x faster in case of many connections. Also psutil.Process.memory_maps()
is slightly faster.
- #714: [OpenBSD] virtual_memory().cached value was always set to 0.


3.3.0 - 2015-11-25
Expand Down
7 changes: 5 additions & 2 deletions psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,18 @@
CLOCK_TICKS = os.sysconf("SC_CLK_TCK")
PAGESIZE = os.sysconf("SC_PAGE_SIZE")
BOOT_TIME = None # set later
BIGGER_FILE_BUFFERING = 8192
# Used when reading "big" files, namely /proc/{pid}/smaps and /proc/net/*.
# On Python 2, using a buffer with open() for such files may result in a
# speedup, see: https://github.com/giampaolo/psutil/issues/708
BIGGER_FILE_BUFFERING = -1 if PY3 else 8192
LITTLE_ENDIAN = sys.byteorder == 'little'
if PY3:
FS_ENCODING = sys.getfilesystemencoding()
if enum is None:
AF_LINK = socket.AF_PACKET
else:
AddressFamily = enum.IntEnum('AddressFamily',
{'AF_LINK': socket.AF_PACKET})
{'AF_LINK': int(socket.AF_PACKET)})
AF_LINK = AddressFamily.AF_LINK

# ioprio_* constants http://linux.die.net/man/2/ioprio_get
Expand Down

0 comments on commit 1152f96

Please sign in to comment.