Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion old buffer syntax vs memoryviews: speed
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dag Sverre Seljebotn  
View profile  
 More options Nov 5 2012, 9:46 am
From: Dag Sverre Seljebotn <d.s.seljeb...@astro.uio.no>
Date: Mon, 05 Nov 2012 15:46:14 +0100
Local: Mon, Nov 5 2012 9:46 am
Subject: Re: [cython-users] old buffer syntax vs memoryviews: speed
On 11/05/2012 03:36 PM, Sturla Molden wrote:

> On 05.11.2012 13:46, stefandw wrote:
>> Hello everybody, I have a question about memoryviews (which will
>> undoubtedly show my lack of understanding of the low level details of it
>> all).

>> Basically, my problem is that replacing the old buffer syntax with
>> memoryview syntax makes my function twice as slow.
>> Here is the code. It takes an numpy array as input and returns a new
>> numpy array where the sum of column elements has been normalized to 1.

> The main problem is that your program loops over discontinuous memory.
> Swap the order of i and j. Also declare the arrays you know to be
> contiguous to be contiguous (e.g. TM).

Note that the matrices were 8x8 matrices, so you hit L1 cache anyway;
this is not it.

I think the problem is that the overhead is in the "np.empty" and the
acquisition of the buffer. memoryviews may well be slower during
acquisition, I don't think that aspect was optimized, performance focus
was on a) performance for larger arrays, b) quickly making slices of
already acquired memoryviews.

Dag Sverre


 
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.