There is another difference. Under 3.4 it seems to run a lot faster. I had
a statement that printed out every 1000 times through the loop and with 5.1
I had to reduce it to printing every 100 time to get the same elapsed time
per output. Must have to do with the way that immediate assignments are
handled. The memory seems to be increasing under 5.1 at about 1M/1000
iterations. This would say that after 10^5 it would be over 100M bigger.
I noticed that the amount of CPU time was about the same: 3 CPU
seconds/1000 iterations. Maybe I will wait for a while before migrating
to V5.1.
Here is a dump of the memory (in MB) after every 100 iterations:
1000 : 4.5546875
1100 : 4.6328125
1200 : 4.71875
1300 : 4.796875
1400 : 4.8828125
1500 : 4.96875
1600 : 5.046875
1700 : 5.1328125
1800 : 5.2109375
1900 : 5.2890625
2000 : 5.3671875
2100 : 5.4609375
2200 : 5.546875
2300 : 5.6171875
2400 : 5.703125
2500 : 5.78125
2600 : 5.8671875
2700 : 5.953125
2800 : 6.03125
2900 : 6.1171875
3000 : 6.1953125
3100 : 6.2734375
3200 : 6.359375
3300 : 6.4453125
3400 : 6.53125
3500 : 6.6015625
3600 : 6.6875
3700 : 6.765625
3800 : 6.8515625
3900 : 6.9375
4000 : 7.015625
Jim Holtman
Vadim Ogranovich <vograno@arbitrade.com> on 01/26/2000 16:54:47
To: "'james.holtman@convergys.com'" <james.holtman@convergys.com>
cc: (bcc: James Holtman/CIMG/CVG)
Subject: RE: [S] Q: how avoid memory build up during loops and function ca
lls
Yes, indeed it was V5.1. Here are more details.
Version 5.1 Release 1 for Sun SPARC, SunOS 5.5 : 1999
It also starts from 35M. Is anything wrong with V5.1?
Thanks, Vadim
-----Original Message-----
From: james.holtman@convergys.com
[mailto:james.holtman@convergys.com]
Sent: Wednesday, January 26, 2000 1:33 PM
To: Vadim Ogranovich
Subject: Re: [S] Q: how avoid memory build up during
loops and function calls
I ran the same script on V3.4 and the process at the end was
only 10M.
WHen I first load it, it starts at 7M. Were you running
V5.1?
Jim Holtman
Vadim Ogranovich <vograno@arbitrade.com> on 01/26/2000
15:58:11
To: "'S-news@wubios.wustl.edu'" <S-news@wubios.wustl.edu>
cc: (bcc: James Holtman/CIMG/CVG)
Subject: [S] Q: how avoid memory build up during loops and
function calls
Hi, I thought that options "compact" and "free" should
provide a relief
from
memory build-up during long iterations. This does not seem
to work. Here
are
two (meaningless) examples where I am trying to accumulate a
value during a
loop or lapply:
> assign("r", rnorm(100), where=1, immed=T)
> for (i in seq(10^5)) { assign("r", rnorm(1000), where=1,
immed=T) }
After completion the process size is 112M! Here is the same
stuff done
through lapply - it is neither faster nor more memory
efficient:
> assign("r", rnorm(100), where=1, immed=T)
> lapply(as.list(seq(10^5)), function(x) { assign("r",
rnorm(1000),
where=1,
immed=T); NULL })
The process size is 130M!
The value of the compact option on my machine is 10^5,
free=1.
Could you tell why S-Plus was unable to reclaim the memory?
Thanks,
Vadim
============================================================
compact=
Internal memory built up during a loop ( for, while, or
repeat) will be
compacted when the possibly recoverable amount
exceeds this number of bytes. Giving a value of 0 (or
FALSE) to compact
turns off compacting. This choice, or a large value
for compact trades off more memory growth for less time
spent in
compacting. While the best value depends somewhat on the
problem you are working, it depends more on the
configuration and load
of the computer system. Your local S-PLUS
administrator may have chosen a reasonable value for
your system; if
so,
you usually should not change it yourself.
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To
unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY
of the
message: unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|