Dear all,

it just occurred to me that I think I want to have another optimization
done. Consider, again, qelt$IIARRAY2.  I currently have
-------------------------------------------------------------------------------
InnerIndexedTwoDimensionalArray(R,mnRow,mnCol,Row,Col):

[...]

    qelt(m,i,j) ==
-- we use mnRow and mnCol because the won't be inlined with the current SPAD
-- (as of 04/2008) 
      qelt(qelt(m,i - mnRow)$Rep,j - mnCol)
-------------------------------------------------------------------------------

That translates into
-------------------------------------------------------------------------------
(DEFUN |IIARRAY2;qelt;$2IR;10| (|m| |i| |j| $)
  (PRIMARRQELT (PRIMARRQELT |m| (INTMINUS |i| (QREFELT $ 7)))
               (INTMINUS |j| (QREFELT $ 8)))) 
-------------------------------------------------------------------------------

But that looks quite suboptimal to me!  Why don't we have
-------------------------------------------------------------------------------
(DEFUN |IIARRAY2;qelt;$2IR;10| (|m| |i| |j| mnrow mncol $)
  (PRIMARRQELT (PRIMARRQELT |m| (INTMINUS |i| mnrow))
               (INTMINUS |j| mncol)))
-------------------------------------------------------------------------------
i.e., why doesn't SPAD "augment" the exported functions with the parameters of
the constructor, at least those which aren't types?  I guess that change won't
be especially easy, but wouldn't it be desirable?  Or is (QREFELT $ 7) as
efficient as fetching something from the list of arguments?

Note that otherwise the current situation is especially nasty if we loop:
-------------------------------------------------------------------------------
for i in 1..n repeat 
    for j in 1..n repeat
        a.(i, j) := random 1000
-------------------------------------------------------------------------------
will fetch mnRow roughly n^2 times...

Martin


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to