Skip to content

Instantly share code, notes, and snippets.

@pitrou
Created January 7, 2015 09:04
Show Gist options
  • Save pitrou/f5b61b8bc3283dd206da to your computer and use it in GitHub Desktop.
Save pitrou/f5b61b8bc3283dd206da to your computer and use it in GitHub Desktop.
>>> print(type(a), a.dtype, a[:10])
<class 'numpy.ndarray'> [('x', '<i4'), ('y', '<f4')] [(0, 0.0) (1, 0.0) (2, 0.0) (3, 0.0) (4, 0.0) (5, 0.0) (6, 0.0) (7, 0.0)
(8, 0.0) (9, 9.171498449005928e-41)]
>>> print(type(aa), aa.dtype, aa[:10])
<class 'numpy.core.records.recarray'> [('x', '<i4'), ('y', '<f4')] [(0, 0.0) (1, 0.0) (2, 0.0) (3, 0.0) (4, 0.0) (5, 0.0) (6, 0.0) (7, 0.0)
(8, 0.0) (9, 9.171498449005928e-41)]
>>> %timeit numba_copy_x_to_y(a, b)
100000 loops, best of 3: 3.51 µs per loop
>>> %timeit numba_copy_x_to_y(aa, bb)
10000 loops, best of 3: 157 µs per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment