Subject: Revision 1.123 of simp.lisp: Replacing *quo
From: Dieter Kaiser
Date: Thu, 28 Oct 2010 23:30:36 +0200
The function *quo has been cut out and has been replaced by a call of
'/' or quot in simp.lisp and in other files. I have done some work on
simp.lisp, therefore I have analyzed some of the code carefully. I think
a more correct change would be to replace *quo in the routines addk,
*red and exptrl with truncate and in simpquot with '/'.
The effect might be small and subtle and I have not found a changed
result up to now. But we can see that something has changed when we take
a profile of some of the routines. I have done it for revision 1.122
(before cutting out *quo) and revision 1.123. At last I have inserted
the functions truncate and '/' at the places where I think it is more
correct.
Revision 1.122 and the last example only differ in the time. The last
example is a bit faster as it is expected. We have the same results for
'consed' and 'calls'.
The main difference between revision 1.123 and the 1.122 is, that we get
more consing for revision 1.123 (the effect is small).
My conclusion is, that revision 1.123 is not completely equivalent to
revision 1.122. If we change *quo in a way which is consistent with the
algorithm we get no more changes as a bit faster routines.
All this might be not worth to think about. But because some of the main
simplifying routines have changed, we might have a look at the reasons
of the small changes. Another point is, that it seems to be not obvious
to replace *quo with '/' at some places in simp.lisp.
The following results I have got with SBCL:
Profiling for simp.lisp revision 1.122:
seconds | consed | calls | sec/call | name
----------------------------------------------------------------
16.939 | 3,165,888,352 | 5,221,803 | 0.000003 | SIMPTIMES
16.620 | 883,036,152 | 9,488,557 | 0.000002 | TIMESIN
8.219 | 1,109,450,920 | 5,577,321 | 0.000001 | TIMESK
7.075 | 656,217,176 | 2,696,185 | 0.000003 | ADDK
3.667 | 471,784,384 | 1,749,432 | 0.000002 | EXPTRL
3.134 | 109,107,640 | 903,161 | 0.000003 | PLUSIN
0.882 | 155,026,264 | 6,926,209 | 0.0000001 | PLS
0.592 | 40,057,168 | 1,489,528 | 0.0000004 | *RED
0.219 | 6,529,176 | 333,299 | 0.000001 | TIMESKL
0.000 | 462,247,336 | 3,670,000 | 0.000000 | SIMPLUS
0.000 | 160,640,592 | 10,497,283 | 0.000000 | TMS
0.000 | 9,119,888 | 50,356 | 0.000000 | SIMPQUOT
----------------------------------------------------------------
57.348 | 7,229,105,048 | 48,603,134 | | Total
Profiling for simp.lisp revision 1.123:
seconds | consed | calls | sec/call | name
----------------------------------------------------------------
17.401 | 3,166,171,024 | 5,221,803 | 0.000003 | SIMPTIMES
16.031 | 885,409,776 | 9,488,557 | 0.000002 | TIMESIN
8.319 | 1,108,847,040 | 5,577,321 | 0.000001 | TIMESK
6.594 | 656,461,784 | 2,696,185 | 0.000002 | ADDK
3.888 | 473,605,712 | 1,749,432 | 0.000002 | EXPTRL
3.264 | 109,196,872 | 903,161 | 0.000004 | PLUSIN
0.835 | 155,858,832 | 6,926,209 | 0.0000001 | PLS
0.569 | 39,448,584 | 1,489,528 | 0.0000004 | *RED
0.111 | 6,802,904 | 333,299 | 0.0000003 | TIMESKL
0.000 | 461,864,216 | 3,670,000 | 0.000000 | SIMPLUS
0.000 | 159,489,096 | 10,497,283 | 0.000000 | TMS
0.000 | 9,217,528 | 50,356 | 0.000000 | SIMPQUOT
----------------------------------------------------------------
57.011 | 7,232,373,368 | 48,603,134 | | Total
Profiling with *quo replaced by "truncate" and "/" at the appropriate
places:
seconds | consed | calls | sec/call | name
----------------------------------------------------------------
13.447 | 3,165,888,352 | 5,221,803 | 0.000003 | SIMPTIMES
16.026 | 883,036,152 | 9,488,557 | 0.000002 | TIMESIN
8.804 | 1,109,450,920 | 5,577,321 | 0.000002 | TIMESK
7.033 | 656,217,176 | 2,696,185 | 0.000003 | ADDK
3.678 | 471,784,384 | 1,749,432 | 0.000002 | EXPTRL
3.290 | 109,107,640 | 903,161 | 0.000004 | PLUSIN
1.359 | 155,026,264 | 6,926,209 | 0.0000002 | PLS
0.716 | 40,057,168 | 1,489,528 | 0.0000005 | *RED
0.211 | 6,529,176 | 333,299 | 0.000001 | TIMESKL
0.000 | 462,247,336 | 3,670,000 | 0.000000 | SIMPLUS
0.000 | 160,640,592 | 10,497,283 | 0.000000 | TMS
0.000 | 9,119,888 | 50,356 | 0.000000 | SIMPQUOT
----------------------------------------------------------------
54.562 | 7,229,105,048 | 48,603,134 | | Total
Dieter Kaiser