Hi, all.
I've noticed a worrying performance issue, and I was wondering
if you could shed some light onto it.
In ginsh, the time to do a simple expand() seems to get worse
the more variables you've defined. Here's a test script:
FIRST_RUN;
time(e1=expand((2*x+3*y+5*z)^100));
time(e2=expand((2*x+3*y+5*z)^100));
time(e3=expand((2*x+3*y+5*z)^100));
time(e4=expand((2*x+3*y+5*z)^100));
time(e5=expand((2*x+3*y+5*z)^100));
time(e6=expand((2*x+3*y+5*z)^100));
time(e7=expand((2*x+3*y+5*z)^100));
time(e8=expand((2*x+3*y+5*z)^100));
time(e9=expand((2*x+3*y+5*z)^100));
UNASSIGN;;
unassign('e1'):
unassign('e2'):
unassign('e3'):
unassign('e4'):
unassign('e5'):
unassign('e6'):
unassign('e7'):
unassign('e8'):
unassign('e9'):
SECOND_RUN;
time(f1=expand((2*x+3*y+5*z)^100));
time(f2=expand((2*x+3*y+5*z)^100));
time(f3=expand((2*x+3*y+5*z)^100));
time(f4=expand((2*x+3*y+5*z)^100));
time(f5=expand((2*x+3*y+5*z)^100));
time(f6=expand((2*x+3*y+5*z)^100));
time(f7=expand((2*x+3*y+5*z)^100));
time(f8=expand((2*x+3*y+5*z)^100));
time(f9=expand((2*x+3*y+5*z)^100));
The output is:
FIRST_RUN
0.00923s
0.008251s
0.007379s
0.007837s
0.015366s
0.015251s
0.019319s
0.020222s
0.021082s
UNASSIGN
SECOND_RUN
0.00717s
0.006453s
0.006901s
0.007438s
0.015191s
0.012014s
0.015484s
0.018273s
0.019675s
As you can see the expansion time for e9 is 2x that of e1, and
if I'll continue, it will keep rising, to e.g. 20x at e100 and
beyond.
However, if I'll unassign the variables, the expansion time will
be back to the original value.
My guess would be that some kind of a caching system is at fault
for this. Do you have any ideas as to which one exactly, and how
to solve this?
Thanks in advance,
Vitaly