Hi, I just found the Jupyter session is seriously slower than the SageNB one.
This was the snippet to reproduce:
# intersection profiling with Python session
from sage.all import *
def run(num):
cube = (polytopes.cube() * 37 / 45).change_ring(QQ)
for i in range(num):
hspace = Polyhedron(ieqs=[[1/2, 1/(i+1), 0, 0]]).change_ring(QQ)
intersection = hspace.intersection(cube)
%timeit run(100)
The timing in SageNB is 1 loop, best of 5: 186 ms per loop
, while that in Jupyter is 1 loop, best of 5: 7.07 s per loop
. With this snippet I think no variable was cached. I also cprofiled a stand-alone .py file with the same lines (expect the %timeit
line), whose timing is close to the Jupyter one. Any idea what could cause this huge performance difference?