Hi Martin!
On 1 Dez., 20:30, Martin Albrecht <
m...@informatik.uni-bremen.de>
wrote:
[...]
> Sure, but up to 50 seconds for a simple coercion seems way way too much even
> in that case.
Agreed. Let's try to find out what happens here.
My first thought was that it is due to the huge polynomial rings. But
the following seems to indicate that it is really a problem with
coercion and categories, after all:
sage: sage: IP = InfinitePolynomialRing(QQ)
sage: sage: x = IP.gen()
sage: sage: x10000 = x[10000]
sage: sage: %time 1/2*x10000
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.00 s
1/2*x10000
sage: sage: x10001 = x[10001]
sage: %prun 1/2*x10000
11924289 function calls (11804267 primitive calls) in 46.270
CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno
(function)
1 19.536 19.536 46.270 46.270
infinite_polynomial_element.py:1190(_mul_)
8 10.051 1.256 24.464 3.058 pushout.py:506(pushout)
40004 3.854 0.000 3.854 0.000 {method 'intersection'
of 'set' objects}
520078 2.978 0.000 4.041 0.000 {built-in method sub}
240115 2.410 0.000 3.178 0.000 category.py:74(__init__)
80012/40008 1.147 0.000 7.033 0.000 pushout.py:193
(__mul__)
520078 0.927 0.000 1.158 0.000 re.py:229(_compile)
120028 0.717 0.000 4.295 0.000 pushout.py:144(__init__)
520078 0.624 0.000 5.823 0.000 re.py:144(sub)
520078 0.566 0.000 1.063 0.000 re.py:271(_subx)
520078 0.317 0.000 0.497 0.000 re.py:251(_compile_repl)
1040203 0.314 0.000 0.314 0.000 {method 'get' of 'dict'
objects}
1240409 0.303 0.000 0.303 0.000 {isinstance}
40008 0.273 0.000 0.395 0.000 pushout.py:49(__init__)
160020 0.258 0.000 0.641 0.000 pushout.py:175(__cmp__)
...
So, most of the time is spent for "pushout.py" and "category.py". It
isn't explicitely used in InfinitePolynomialRing/Element, so, I guess
there is indeed some coercion problem.
Nevertheless, the regular expression business isn't good either. I'll
see what I can do -- recent sage-devel/sage-support threads indicated
some improvements.
Best regards,
Simon