Haskell GHCi (interpreted) timings:

Integer (arbitrary precision arithmetic)

*Main> foldl1' (+) $ replicate 100000000 52
5200000000
(12.82 secs, 7447947224 bytes)

fl. p. arithmetic:
                              
*Main> foldl1' (+) $ replicate 100000000 52.0
5.2e9
(4.37 secs, 4015930492 bytes)

For a comparison. Here are the J results on my computer:

   5 ts '+/100000000#52'
0.999619 536872256

   ts '+/100000000#52x'
115.643758 536872768


=@@i



Oleg Kobchenko schreef:
> Difference in speed was kind of expected--maybe not to that degree.
>
> Does it show that modern hardware does not provide enough to scale
> for this kind of calculation?
> Can anyone supply a comparison from other languages or libs: python, Haskel, 
> Maple etc?
>
> Interesting was almost the same space.
> I thought it'd blow out the memory.
>
>
> On Sep 27, 2008, at 14:48, Roger Hui <[EMAIL PROTECTED]> wrote:
>
> 52+52 is one hardware instruction and
> 52x+52x is implemented by software,
> hence the 2 orders of magnitude difference 
> in time.
>
>
>
> ----- Original Message -----
> From: Oleg Kobchenko <[EMAIL PROTECTED]>
> Date: Saturday, September 27, 2008 10:04
> Subject: Re: [Jgeneral] Limit error
> To: General forum <[email protected]>
>
> Interesting to compare 
>
>    +/100000000#52    NB. about 1 sec
> 5.2e9
>
>    +/100000000#52x   NB. about 1 min
> 5200000000
>
> about the same memory. 
>
> Let's verify precisely:
>
>    10 ts '+/100000000#52'
> 0.834533 5.36872e8
>
>    2 ts '+/100000000#52x'
> 54.2623 5.36873e8
>
>
>
>
> From: Joey K Tuttle <[EMAIL PROTECTED]>
>
> I thought displaying it would be boring - but maybe not any 
> more 
> boring than $ or +/ ...
>
> At 08:40  -0700 2008/09/27, Roger Hui wrote:
> The difference is that Joey's expression did not
> try to generate the display of 1e8#52 but Paul's
> expression did, and it's in the generation of
> that display that the limit error was signaled.
>
>
>
> ----- Original Message -----
> From: Joey K Tuttle 
> Date: Saturday, September 27, 2008 8:22
> Subject: Re: [Jgeneral] Limit error
> To: General forum 
>
>   Works OK on my Mac...
>
>       $100000000 # 52
>   100000000
>
>       version ''
>   Installer: j602a_mac_powerpc.dmg
>   Engine: j602/2008-03-03/16:45
>   Library: 6.02.023ProductName:    Mac 
> OS X
>   ProductVersion:    10.5.5
>
>
>   At 15:52  +0100 2008/09/27, Paul Moore wrote:
>   >In J32 on Windows, 100000000 # 52 gives a limit 
> error. What
>   does this
>   >mean? I can't see anything stating that there is a 
> limit in
>   array size
>   >(other than available memory) in the documentation.
>   >
>   >Is it possible for me to create a hundred-million 
> entry array? (Such
>   >an array of integers would be 400M in size, I have 
> 2G so memory
>   should>not be an issue).
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
>       
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>   
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to