Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PyImath array objects use the buffer protocol #367

Open
tbttfox opened this issue Jan 10, 2019 · 0 comments
Open

Make PyImath array objects use the buffer protocol #367

tbttfox opened this issue Jan 10, 2019 · 0 comments
Labels
Feature Request A suggested change or addition of functionality to the library.

Comments

@tbttfox
Copy link

tbttfox commented Jan 10, 2019

I think the python imath *Array objects should implement the python buffer protocol to allow for fast IO.

Right now all we have is imathnumpy, which is a not-even-half-implemented module that requires the numpy library to use. And numpy isn't always available (I'm looking at you, Windows Maya). This means that any data IO must go through python lists to make portable code. This can be between 20x and 100x slower than imathnumpy depending on implementation.

The python buffer protocol is strided. So since FixedArray already stores the data contiguous+strides, and the Imath classes are contiguous (at least at first glance), it seems it would be straightforward to build and read memoryview(for Python 3 compatibility) objects through some added methods.

Then imathnumpy could be removed/deprecated, because numpy supports reading directly from python buffers.

@cary-ilm cary-ilm added the Feature Request A suggested change or addition of functionality to the library. label Jun 13, 2019
@cary-ilm cary-ilm added the Needs Discussion To be discussed in the technical steering committee label Jun 26, 2019
@cary-ilm cary-ilm added this to the Next Major Release milestone Feb 7, 2020
@cary-ilm cary-ilm removed the Needs Discussion To be discussed in the technical steering committee label Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request A suggested change or addition of functionality to the library.
Projects
None yet
Development

No branches or pull requests

2 participants