Marc Mezzarobba wrote: > Some profiling data (via linux-perf) for > > sage: def f(): > ....: for i in [x]range(100000000): > ....: a+a
where a = Integer(1). If a is made local to the function, the very expensive lookups disappear, and we still see calls to PyLong_FromLong taking much longer than PyInt_FromLong, as Vincent suspected. However, I don't understand why PyLong_FromLong needs to be called at all here. - 79,71% 0,00% python2 libpython2.7.so.1.0 [.] builtin_eval builtin_eval PyEval_EvalCode PyEval_EvalCodeEx PyEval_EvalFrameEx call_function (inlined) fast_function (inlined) - PyEval_EvalFrameEx + 19,47% PyNumber_Add + 4,23% __pyx_f_4sage_5rings_7integer_fast_tp_dealloc - 2,19% PyInt_FromLong PyInt_FromLong 1,65% rangeiter_next 1,12% PyInt_FromLong@plt 0,67% 0x7fde644a906 - 77,70% 0,00% python3 libpython3.7m.so.1.0 [.] builtin_eval builtin_eval builtin_eval_impl (inlined) PyEval_EvalCode PyEval_EvalCodeEx _PyEval_EvalCodeWithName _PyEval_EvalFrameDefault call_function (inlined) function_code_fastcall - _PyEval_EvalFrameDefault + 15,77% PyNumber_Add - 13,30% PyLong_FromLong + 10,01% _PyLong_New 0,63% _PyLong_New@plt + 8,37% _PyObject_Free + 2,70% __pyx_f_4sage_5rings_7integer_fast_tp_dealloc 1,20% rangeiter_next 0,83% PyLong_FromLong@plt 0,83% PyNumber_Add@plt -- Marc -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/qrde2u%242uk%241%40blaine.gmane.org.