wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
530 stars 75 forks source link

plyvel should accept memoryviews as keys and values #52

Closed kyuupichan closed 6 years ago

kyuupichan commented 7 years ago

I passed a memoryview to db.put() as the value, and I got an error

TypeError: Argument 'value' has incorrect type (expected bytes, got memoryview)

I doubt there is a good reason for this. Can you accept memoryviews too please in all relevant APIs? They enable me to avoid redundant copying of big binary objects when taking slices.

wbolster commented 7 years ago

there is no deliberate reason indeed.

but i think there could be some complexity. i think py2 and py3 work differently, and we're using cython.

feel free to suggest patches, or make a list of public api that would be touched by this.

(my time is limited. this is a spare time project.)

wbolster commented 7 years ago

@kyuupichan any chance you can test #53 and report back your findings?

wbolster commented 7 years ago

ping @kyuupichan

i did some work on your request. your feedback would be appreciated.

kyuupichan commented 7 years ago

Sorry I have worked around the issue. In fact I am no longer using memoryviews.

On Tue, 25 Oct 2016, 00:38 Wouter Bolsterlee, notifications@github.com wrote:

ping @kyuupichan https://github.com/kyuupichan

i did some work on your request. your feedback would be appreciated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wbolster/plyvel/issues/52#issuecomment-255777200, or mute the thread https://github.com/notifications/unsubscribe-auth/ADKliDS8PLienz1Qiam4cGqi6WyTEV0vks5q3NDzgaJpZM4KMk4T .