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.