[Tutor] improving speed using and recalling C functions

Gabriele Brambilla gb.gabrielebrambilla at gmail.com
Sat Apr 12 01:41:48 CEST 2014

Ok guys, when I wrote that email I was excited for the apparent speed
increasing (it was jumping the bottleneck for loop for the reason peter
otten outlined).
Now, instead the changes, the speed is not improved (the code still running
from this morning and it's at one forth of the dataset).

What can I do to speed it up?



sent from Samsung Mobile
Il giorno 11/apr/2014 17:00, "Danny Yoo" <dyoo at hashcollision.org> ha

> On Fri, Apr 11, 2014 at 1:01 PM, Gabriele Brambilla
> <gb.gabrielebrambilla at gmail.com> wrote:
> > Yes,
> > but I want to make a C extension to run faster a function from
> > scipy.interpolate (interp1d)
> Just to emphasis: I believe your goal should be: "I want to make my
> program fast."
> Your goal should probably not be: "I want to write a C extension".
> I'm not saying that writing a C extension is necessarily wrong, and it
> may be that writing a C extension will make your program fast.  But
> this approach may not be the easiest or most maintainable approach to
> improving your program's performance.
> Using C is not without its costs and risks.  As soon as you are in C
> territory, the seat belts are off.  Just recall the craziness that
> happened this week with regards to programs written in low-level
> languages like C.  Explicitly: http://heartbleed.com.  If you are
> writing with C, you have to be very, very delicate with your code.
> Experts get it wrong, with severe consequences.
> This is why the focus on C extensions to get speed disturbs me so
> much: it assumes that C is a safe language to use.  It's not,
> especially for beginners. We should strongly discourage low-level
> languages unless there is some overriding concern.  For scientific
> calculations like the ones you are doing, you should place a premium
> on getting a right answer, and not just a fast answer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140411/695a8db3/attachment.html>

More information about the Tutor mailing list