Python question - first call is slower?

Python question - first call is slower?

Amos Shapira amos.shapira at gmail.com
Wed Jun 20 10:41:34 IDT 2012


On 20 June 2012 16:46, Nadav Har'El <nyh at math.technion.ac.il> wrote:

> On Wed, Jun 20, 2012, Oleg Goldshmidt wrote about "Re: Python question -
> first call is slower?":
> > I would - naively! - think that "stuff (not only, or necessarily, the
> > python code stuff, but also what it needs from the system) would indeed
> be
> > loaded dynamically when it is needed. I don't base this on anything I
> know,
> > but on the intuitive notion that whatever Python does works as "normal C
> > libraries" - it's implemented in C, right?
>
> This is a good angle to investigate, although since I noticed the
> function becomes uniformly slower (after 1/3rd of the code, it spends
> 1/3rd of 14 milliseconds), it would be strange that I am loading so many
> shared libraries for this to be so uniform, but I guess anything is
> possible.
>

How about  "strace -ttt" and "ltrace -ttt", could they reveal where your
missing time is spent?

> In general, t does not surprise me that something - whatever - runs slower
> Yes, its sad that computer software has become so complex that often you
> don't understand what your program *really* does, and you start to
> accept annoying phenomenon as laws of nature :( In a few years, when
> software is as complex as human brains, I guess it would be normal to
> explain that some software is slower today because it is depressed ;-)
>

Add to that code writers (I wouldn't dignify what they do by labeling it as
"programming") who don't have the slightest idea of how even simple
programs really work and you end up with a vicious circle of wasted CPU
cycles.

--Amos

 [image: View my profile on LinkedIn]
<http://www.linkedin.com/in/gliderflyer>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20120620/8883d984/attachment.html>


More information about the Linux-il mailing list