Ticket #314 (closed enhancement: fixed)

Opened 5 years ago

Last modified 22 months ago

[patch] array.pxd - fast Cython access for Python's builtin array.array

Reported by: rk Owned by: andreasvc
Priority: major Milestone: 0.17
Component: Library Keywords:
Cc: brentp

Description

in attachment:

array.pxd

Cython direct interface to Python's array.array type (builtin module).

  • 1D contiguous data view
  • 2D views - contigious or [x,y] transposed/strided
  • tools for fast array creation, maximum C-speed and handiness
  • suitable as allround light weight auto-array within Cython code too

See also: array_example.pyx and doc strings

Note: arrayarray.h (arrayobject, arraydescr) is not part of the official Python C-API so far. Would go into Cython/include/ or python/include/cython/ or next to array.pxd ?

Attachments

array.pxd Download (9.1 KB) - added by rk 5 years ago.
arrayarray.h Download (3.5 KB) - added by rk 5 years ago.
array_example.pyx Download (2.6 KB) - added by rk 5 years ago.
array.zip Download (6.2 KB) - added by rk 5 years ago.
Update (fast array/buffer concats, and some cleanup)
array.2.zip Download (6.2 KB) - added by rk 5 years ago.
Update - minor changes
array.simple.diff Download (14.8 KB) - added by brentp 4 years ago.
update to patch

Change History

Changed 5 years ago by rk

Changed 5 years ago by rk

Changed 5 years ago by rk

Changed 5 years ago by rk

  • component changed from Build System to Optimization

Changed 5 years ago by rk

Update (fast array/buffer concats, and some cleanup)

Changed 5 years ago by rk

Update - minor changes

Changed 4 years ago by scoder

  • summary changed from array.pxd - fast Cython access for Python's builtin array.array to [patch] array.pxd - fast Cython access for Python's builtin array.array

Changed 4 years ago by scoder

  • component changed from Optimization to Library

According to Dag, this needs some cleanup before being added. The proposal is to keep the plain array support simple and move any 2D support into a subclass, as most people will not use it, and its use should be explicit.

Changed 4 years ago by brentp

update to patch

Changed 4 years ago by brentp

 patch simplifies some of the stuff above. removes 2d support. still relies on arrayarray.h (which uses #if macros to support more python version). any comments on how to get that into a .pxi?

Changed 4 years ago by brentp

  • cc brentp added

Changed 4 years ago by SamB

Hmm, this seems pretty nice so far, but it doesn't quite build with MSVC (which it must to be usable with the usual Windows builds of Python).

  1. arrayarray.h uses GCC's "mixed declarations and code" extension (in resize_smart())
  2. It also uses the inline reserved word directly, rather than using the Py_LOCAL_INLINE macro to make sure the correct syntax is used for the compiler / settings in question. (This may be especially important considering the fact that at one point, C99 requires exactly-opposite behaviour from that traditionally offered by GCC, but MSVC doesn't even have inline as a keyword, so it's kind of moot.)

Changed 22 months ago by scoder

  • owner changed from somebody to andreasvc

Changed 22 months ago by scoder

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from wishlist to 0.17

Closing as fixed because the most interesting part of this patch has been merged. 2D view support has been deliberately excluded.

Note: See TracTickets for help on using tickets.