[Checkins] [zopefoundation/BTrees] 4debe1: Use operator.index to avoid DeprecationWarning on ...

GitHub noreply at github.com
Fri Mar 9 12:59:59 CET 2018


  Branch: refs/heads/issue79
  Home:   https://github.com/zopefoundation/BTrees
  Commit: 4debe1bbb158df09f198e40d4b8e676aa63faf27
      https://github.com/zopefoundation/BTrees/commit/4debe1bbb158df09f198e40d4b8e676aa63faf27
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2018-03-09 (Fri, 09 Mar 2018)

  Changed paths:
    M BTrees/_base.py
    M CHANGES.rst

  Log Message:
  -----------
  Use operator.index to avoid DeprecationWarning on Python 2

Fixes #79

Slightly faster on CPython:

$ python -m perf timeit -s 'from struct import Struct; s = Struct("i"); unpack=s.unpack; pack=s.pack' 'unpack(pack(123456))'
.....................
Mean +- std dev: 252 ns +- 12 ns
$ python -m perf timeit -s 'from struct import Struct; s = Struct("i"); from operator import index; pack=s.pack' 'pack(index(123456))'
.....................
Mean +- std dev: 235 ns +- 6 ns

Very slightly faster on PyPy:

python -m perf timeit -s 'from struct import Struct; s = Struct("i"); unpack=s.unpack; pack=s.pack' 'unpack(pack(123456))'
.........
Mean +- std dev: 4.24 ns +- 0.12 ns
$ python -m perf timeit -s 'from struct import Struct; s = Struct("i"); from operator import index; pack=s.pack' 'pack(index(123456))'
.........
Mean +- std dev: 4.19 ns +- 0.10 ns




More information about the checkins mailing list