[Numpy-svn] [numpy/numpy] d43806: ENH: avoid expensive PyArg_ParseTuple in void oper...

GitHub noreply at github.com
Mon May 26 15:43:28 EDT 2014


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: d438067813867bc34546b6f1f1683d5981994812
      https://github.com/numpy/numpy/commit/d438067813867bc34546b6f1f1683d5981994812
  Author: Julian Taylor <jtaylor.debian at googlemail.com>
  Date:   2014-05-26 (Mon, 26 May 2014)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src

  Log Message:
  -----------
  ENH: avoid expensive PyArg_ParseTuple in void operations

Replace simple "Oi|O" unpack with faster specialized unpacking

Improves e.g.:

    nrows, ncols = 365, 10000
    items = np.rec.fromarrays(randn(2,265, 10000), names=['widgets','gadgets'])
    row_idx, colidx = randint(0, nrows, ncols), np.arange(ncols)
    %timeit filtered_items = items[row_idx, col_idx]
    In [7]: %timeit filtered_items = items[row_idx, col_idx]
    1000 loops, best of 3: 1.55 ms per loop

to

    In [7]: %timeit filtered_items = items[row_idx, col_idx]
    1000 loops, best of 3: 706 µs per loop


  Commit: e4dc0c9c0a094844e2db60685a59eebe9b6a2bbb
      https://github.com/numpy/numpy/commit/e4dc0c9c0a094844e2db60685a59eebe9b6a2bbb
  Author: Julian Taylor <juliantaylor108 at gmail.com>
  Date:   2014-05-26 (Mon, 26 May 2014)

  Changed paths:
    M numpy/core/src/multiarray/arraytypes.c.src

  Log Message:
  -----------
  Merge pull request #4721 from juliantaylor/void-index

ENH: avoid expensive PyArg_ParseTuple in void operations


Compare: https://github.com/numpy/numpy/compare/d367f63b58de...e4dc0c9c0a09


More information about the Numpy-svn mailing list