Initializing
[1/3] from: chalz::earthlink::net at: 15-Dec-2002 21:13
A little question. What would be the primary differences between something
like:
my-block: copy []
and
my-block: make block! []
? Performance issues? Memory/speed? What other methods are there, without
doing a direct assign (like my-block: [])?
--Charles
[2/3] from: anton:lexicon at: 16-Dec-2002 15:18
Not much, I think.
This should be easy to do speed comparisons.
But make block! has an additional usage:
make block! 25
creates a block with enough preallocated
space for 25 elements, so there is no time
wasted later increasing the block to fit
your inserts.
(The new block still begins with no elements.)
Anton.
[3/3] from: rebol-list2:seznam:cz at: 20-Dec-2002 11:27
Hello Charles,
Monday, December 16, 2002, 3:13:01 AM, you wrote:
C> A little question. What would be the primary differences between something
C> like:
C> my-block: copy []
C> and
C> my-block: make block! []
C> ? Performance issues? Memory/speed? What other methods are there, without
C> doing a direct assign (like my-block: [])?
C> --Charles
with the Rebol/Base:
system/stats/series
;== [4096 2624 1353 1 118 117 70]
t: now/time/precise loop 100000 [make block! []] now/time/precise - t
;== 0:00:00.1
system/stats/series
;== [66048 13825 1199 1 51023 51022 75]
foreach pool system/stats/pools [probe pool]
...
(using new Rebol/Base console)
system/stats/series
;== [4096 2624 1353 1 118 117 70]
t: now/time/precise loop 100000 [copy []] now/time/precise - t
;== 0:00:00.09
system/stats/series
;== [66048 13822 1199 1 51026 51025 75]
foreach pool system/stats/pools [probe pool]
...
So it looks that there is almost no difference between the copy [] and
make block! []
The other issue would be with the make block! 10 which allocates more
memory.
=( Oliva David )=======================( [oliva--david--seznam--cz] )==
=( Earth/Europe/Czech_Republic/Brno )=============================
=( coords: [lat: 49.22 long: 16.67] )=============================