ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 03 Jun 2013 20:49:39 -0500Profiling and select.selecthttp://ask.sagemath.org/question/10188/profiling-and-selectselect/I'm trying to profile my code using prun, and what I'm getting is that the lion's share of the time is spent in something called "select.select", which, according to
[pytho documentation](http://docs.python.org/2/library/select.html) has something to do with I/O. Now, the thing is I'm not using I/O at all, so why does sage call this function?
How can I which function was calling select.select?
Here's the original prun output:
138462 function calls (132753 primitive calls) in 11.954 second
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
588 8.607 0.015 8.607 0.015 {select.select}
1 1.166 1.166 1.168 1.168 maxima_lib.py:929(to_poly_solve)
946 0.658 0.001 0.658 0.001 {method 'search' of '_sre.SRE_Pattern' objects}
40001 0.560 0.000 0.560 0.000 calculus.py:1925(<lambda>)
23 0.318 0.014 1.021 0.044 {method 'parse_sequence' of 'sage.misc.parser.Parser' objects}
231 0.245 0.001 0.288 0.001 maxima_lib.py:380(_eval_line)
46 0.042 0.001 0.043 0.001 maxima_lib.py:242(max_to_string)
2332/1166 0.032 0.000 0.042 0.000 lazy_attribute.py:506(__get__)bolverkMon, 03 Jun 2013 20:49:39 -0500http://ask.sagemath.org/question/10188/gap calls seem to consume a lot of timehttp://ask.sagemath.org/question/8046/gap-calls-seem-to-consume-a-lot-of-time/
I am trying to migrate some code from GAP to sage, and the overhead for calls to GAP procedures is enormous. Here is an example:
----------------------------------------------------------------------
| Sage Version 4.6.2, Release Date: 2011-02-25 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: def test1():
....: for x in xrange(100): gap.eval('G:=Group([(1,2,3)])')
....:
sage: def test2():
....: gap.eval('for x in [1..100] do G:=Group([(1,2,3)]);od')
....:
sage: timeit('test1()')
5 loops, best of 3: 810 ms per loop
sage: timeit('test2()')
25 loops, best of 3: 12.6 ms per loop
Is there anything I am doing wrong?
I tried some profiling, which indicated that most of the time is consumed by "select.select".
Any help will be most welcome.parzanSat, 02 Apr 2011 06:30:45 -0500http://ask.sagemath.org/question/8046/