From: mark florisson <markflorisso...@gmail.com>
Date: Mon, 9 Apr 2012 21:00:11 +0100
Local: Mon, Apr 9 2012 4:00 pm
Subject: Re: [cython-users] use the memoryview slice inside a cdef class as an attribute is slow?
On 9 April 2012 14:54, 刘振海 <1989l...@gmail.com> wrote:
> hi everyone, Thanks for the report, it currently is indeed not as efficient as it > I have played around the memoryview slice since I knew it, it's really > convenient. Thanks, cython developers! > when I try to use the memoryview slice inside a cdef class as an attribute, > I find out using the dot style to get the memoryview slice attribute to set > item or get item is slower than [2],[3] > here is the code: > #cython: boundscheck = False > cdef int i > #[1] the most convenient way but the slowest. time: 1.30s > #[2] the fastest way. time: 0.034s > #[3] directly use numpy array index. time: 1.17s > I dig a little bit the generated C source then I find: > /* "mtest.pyx":17 > since I am not writing parallel code so may be there's no need to acquire > I didn't familiar with python's thread or compiler optimization, it would be > Best Regards, should be. Cython should perform many more optimizations like bounds check optimizations and other loop optimizations as well as many others. At least this problem can be fixed quite easily, so we'll try fixing that for the release. Generally speaking, the acquisition counting (reference counting for You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||