Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!utcsri!geac!jtsv16!itcyyz!yrloc!hui
From: hui@yrloc.ipsa.reuter.COM (Roger Hui)
Subject: Re: Memory usage under J 5.1 /386 (PC)
Message-ID: <1992Sep3.035738.17663@yrloc.ipsa.reuter.COM>
Keywords: j51pc386,memory
Organization: Iverson Software Inc.
References: <695@svcs1.UUCP>
Date: Thu, 3 Sep 92 03:57:38 GMT

Bill Miller writes:
 
> For example, if I do:
> 7!:3 '+/ i. 10000' for 'space to execute', it returns something ca. 200K,
> and I think that is a bit much.  I figure since ints are 4 bytes each on a
> 386, then that expression should take realistically no more than 80K (twice
> what i. 10000 should take, which is 4*10,000.  Perhaps there would be some
> extra temp space needed to compute the +/, but frankly I can't see why
> it would take that much.
 
I think you mean 7!:2 '+/i. 10000'.  +/ converts an internal integer 
array into an internal double-word floating-point array, sums, and 
converts the result into an internal integer array, if possible.  
APL/J provide transparent transition between internal booleans, integers, 
and floating-point numbers, and the preceding procedure for summing internal 
integers works for any integer array (+/i.10000 as well as +/3e5+i.10000).
 
The 200 KB consumed by +/i.10000 break down as follows:
  40 KB  i.10000
  40 KB  lack of special case in monad i. for scalar arguments
  80 KB  conversion of i.10000 into doubles
  40 KB  sloppiness in conversion

------------------------------------
Roger Hui, Iverson Software Inc., 33 Major Street, Toronto, Ontario  M5S 2K9
Phone: (416) 925 6096;  Fax: (416) 488 7559
