[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Why is Axiom so slow?
From: |
William Sit |
Subject: |
Re: [Axiom-developer] Why is Axiom so slow? |
Date: |
Wed, 05 Jul 2006 04:28:27 -0400 |
Hi Bill:
Wow, you are good with Axiom! (and everything else, of course).
> An array data structure can be accessed much more rapidly.
> Try something like this instead:
>
> (1) -> l1:=new(10000,0)$ARRAY1(INT); map!(x+->random(100)+random(100),l1);
>
> Type: OneDimensionalArray Integer
> Time: 0.20 (EV) + 0.08 (GC) = 0.28 sec
>
Axiom can even do 100000 in about 1.35 secs. Still about 7 times as long
as the best try in Mathematica.
In[85]:=
Timing[Table[Random[Integer,100]+Random[Integer,100],{i,1,100000}]][[1]]
Out[85]=
0.203 Second
So, the reason for the difference is that List in Axiom is really a
singly linked list and hence has pointer overhead (both time and space),
right? Indeed most of the time is spent that way (or so it seems):
(12) -> l2:=[0 for i in 1..10000]$List(INT);
Type:
List Any
Time: 0.03 (IN) + 3.92 (EV) + 0.02 (OT) =
3.97 sec
(13) -> map!(x+->random(100)+random(100),l2);
Type:
List Any
Time:
0 sec
(Don't know why the type was List Any! Is this a bug?)
Oops,
(14) -> l2
[157]
Type:
List Any
Time:
0 sec
Why is Axiom so counter-intuitive? Is this another bug? (the doc says
map! for both ARRAY1 and LIST came from HomogeneousAggregate).
Question: if List in Axiom is that much more inefficient than Array, why
does the Interpreter use List as the default?
Thanks,
William
PS Please change my email address to address@hidden