[Python-Dev] FAT Python (lack of) performance
Chris Angelico
rosuav at gmail.com
Tue Jan 26 10:40:08 EST 2016
On Wed, Jan 27, 2016 at 2:28 AM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
>>rosuav at sikorsky:~$ gcc fib.c && time ./a.out
>>1134903170
>>
>>real 0m9.104s
>>user 0m9.064s
>>sys 0m0.000s
>>rosuav at sikorsky:~$ cat fib.c
>>#include <stdio.h>
>>
>>unsigned long fib(unsigned long n)
>>{
>> if (n < 2) return n;
>> return fib(n-2) + fib(n-1);
>>}
>>
>>int main()
>>{
>> printf("%lu\n",fib(45));
>>}
>>
>
> *cough* -O3 *cough*
>
Oh, I'm sorry. Let's try it again.
rosuav at sikorsky:~$ gcc -O3 fib.c && time ./a.out
1134903170
real 0m3.153s
user 0m3.088s
sys 0m0.052s
Cool! Seems to be linear. From which we can deduce that Python on my
system was compiled at about -O275.
ChrisA
More information about the Python-Dev
mailing list