As you may know then it is faster to create an array first and amend
into it rather than add to the array.

I am also pretty sure that boxing operations take longer.


2009/12/14 miridian <[email protected]>:
> Hallo,
>
> I implemented a solution in J for Euler problem 161.
>
> It is very slow.
> :-(
>
> I use a big array to memoize the result and the amend operation
> is very slow.
>
> Here a snippet from my code
>
> time =: 6!:2
> W =: 9
> H =: 12
> C =: 2 ^ 2 * W
> Mem =: ( C, W , H ) $ _1x
>
> The amend take more than 4 seconds.
>
>    time 'Mem =: 4 ( < 1, 2, 3 ) } Mem'
> 4.136996
>
> Is there a way to improve the amend time?
>
> MfG
>
> Luca Masini.
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði
Po Box 127,801 Selfoss ,
t-póst: [email protected]
gsm: +3546985532
sími: +3544781286
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
          /|_      .-----------------------------------.
         ,'  .\  /  | Með léttri lund verður        |
     ,--'    _,'   | Dagurinn í dag                     |
    /       /       | Enn betri en gærdagurinn  |
   (   -.  |        `-----------------------------------'
   |     ) |         (\_ _/)
  (`-.  '--.)       (='.'=)   ♖♘♗♕♔♙
   `. )----'        (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to