Again $table function, speed/functionality improved




On Tue, 18 Aug 2009, iga Lenari wrote:

< > Ziga,
 
< I get these resoults on my machine:
< (%i1) showtime:true;
< Evaluation took 0.0010 seconds (0.0000 elapsed) using 0 bytes.
< (%o1) true
< (%i2) load(table)$
< Evaluation took 0.0800 seconds (0.0810 elapsed) using 4.075 MB.
< (%i3) table(0, [10^5])$
< Evaluation took 0.0050 seconds (0.0060 elapsed) using 780.000 KB.
< (%i4) table(random(1.0), [10^5])$
< Evaluation took 0.3370 seconds (0.3490 elapsed) using 28.323 MB.
< (%i5) create_list(0,i,1,10^5)$
< Evaluation took 0.1110 seconds (0.1110 elapsed) using 2.289 MB.
< (%i6) create_list(random(1.0),i,1,10^5)$
< Evaluation took 0.6000 seconds (0.6070 elapsed) using 29.858 MB.
< (%i7) build_info();
< Maxima version: 5.19.1
< Maxima build date: 12:23 8/17/2009
< host type: i686-apple-darwin8.11.1
< lisp-implementation-type: SBCL
< lisp-implementation-version: 1.0.30
< Evaluation took 0.0010 seconds (0.0250 elapsed) using 3.922 KB.
< 
< SBCL and CMUCL should be near identical in speed so I don't know where the
< difference lies. Perhaps somehow CMUCL is running the interpreted version of
< $table..

I don't believe so. I ran similar tests with 5.18.1 and gcl2.6.8pre and
table and create_list have essentially the same speed, with create_list
slightly faster. This is also true with clisp. 

(%i3) compile_file("/home/lbutler/lisp/table.lisp");
(%i4) table(1,[3]);
Evaluation took 0.0000 seconds (0.0000 elapsed)
(%o4) [1,1,1]
(%i5) for i:1 thru 10 do table(random(1.0),[10^5])$
Evaluation took 17.2000 seconds (17.2300 elapsed)
(%i6) for i:1 thru 10 do create_list(random(1.0),i,1,10^5)$
Evaluation took 16.8800 seconds (16.9000 elapsed)
(%i7) build_info();

Maxima version: 5.18.1
Maxima build date: 13:2 4/20/2009
host type: i686-pc-linux-gnu
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.8

 
< I did post it to the phpBB.
< https://sourceforge.net/apps/phpbb/maxima/viewtopic.php?f=3&t=5

Thank you.

< 
< It's true - it's not a drop in replacement. I don't feel it's much of an
< advantage to be able to use non-symbol indices - I find that step iteration
< (with possibility of negative step) and speed are more useful, but that
< ofcourse depends on what you use Maxima for.

Non-symbol indices arise naturally when one is recursively constructing
a structure. I think it is a bug when a function expects indices to be
symbols (as create_list does, too). 

I agree about the utility of speed and steps.
 
< Another idea - I could modify $table to detect 'non-symbol' indices and in
< these cases use the same algorithm that 'makelist' uses (which is slower)
< internally. Then 'makelist's' functionality would be a subset of 'table's'.
 
I think it would be preferable to have $table call $makelist for such
cases. 

That's my 2p. Leo.


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.