[REBOL] Re: Rebol Memory Allocation Strategy?
From: tim:johnsons-web at: 21-Sep-2002 17:13
* G. Scott Jones <[gscottjones--mchsi--com]> [020921 16:23]:
> Hi, Tim,
> t: now/time/precise
> reform [to-integer system/stats / 1024 "KB"]
> my-f: func[][
> str: make string! 8192
> loop 20000 [append str "akslkjslkjslskjlsj"]
> print reform [to-integer system/stats / 1024 "KB"]
> ]
> loop 100 [my-f]
> print now/time/precise - t
> ;#######
>
> Second script only sets up the string once, memory usage remains essentially
> flat, and it is four times faster than the first.
> ;########second script
> t: now/time/precise
> reform [to-integer system/stats / 1024 "KB"]
> str: make string! 8192
> my-f: func[][
> clear str
> loop 20000 [append str "akslkjslkjslskjlsj"]
> print reform [to-integer system/stats / 1024 "KB"]
> ]
> loop 100 [my-f]
> print now/time/precise - t
> ;########
>
> These scripts probably mean little, but they confirm the idea that it is
> probably better to do less make-ing and more clear-ing. Maybe a real pro
> can comment using my feeble scripts.
> :-)
> Hope this doesn't muddy the waters further.
> --Scott Jones
The comments made by Scott and Ingo seem in step with my own
point of view, *but* I'd like to see Andrew step in here.
I've been learning to work with Andrew's ML dialect and my
question was prompted by Andrew's use of memory in his 'ML
function. From the previous entry that Andrew made regarding
this thread, I believe that 'compose makes a difference in
this strategy. Andrew is deeply informed of rebol and I believe
that his approach is well thought, I'm just not yet understanding
it (yet).
So hopefully Andrew is reading this and will comment further.
-tim-
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com