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. > Another (kinda related) possibility - some cacheing going on? > What happens if you run the program twice - is the first call slow every > time or just the first time? No, every time I run the program, the first call is slow and the subsequent calls are fast. So it's not disk reads or anything which is cached by the system between runs. > In general, t does not surprise me that something - whatever - runs slower > the first time than subsequent times - it happens often. 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 ;-) -- Nadav Har'El | Wednesday, Jun 20 2012, n...@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Spelling mistakes left in for people who http://nadav.harel.org.il |feel the need to correct others. _______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il