[REBOL] Re: Sort by first part of line
From: rotenca:telvia:it at: 7-Sep-2002 14:57
Hi, Sunanda
> It shows some interesting deterioration for long-running Rebol consoles:
because memory use increase more and more.
> But look at the way my sort deteriorates!! It is possible that my code gets
> slugged by an internal garbage-collection, and if we ran it enough times any
> of the benchmarks could be hit by that.
The best thing should be to launch every single test code.
At the end you sill find my two tests. I need raw data, so i must re-read the
test file.
They work well under the new beta (1.2.5) in my tests beta are twice fast on
this sort of code.
Here are my test where you can seel the result of system/stats and allocated
memory increase:
Rebol 1.2.5.3.1 - Celeron 333 RAM 128 Mb Window 98 first edition
reading data : 0:00:00.11 memory allocated: 6465424
Scott : 0:00:02.74 memory allocated: 10714448
Carl : 0:00:02.58 memory allocated: 12752096
Romano : 0:00:01.54 memory allocated: 15060400
Romano-int : 0:00:01.7 memory allocated: 17671880
Joel : 0:00:01.49 memory allocated: 22394888
got same results
done
By other test i noticed than Joel code use 3 Mb memory more than others tests.
-----------code-----------
;; Romano -- parse sort
;; -------------------
data: read %../public/www.pusatberita.com/test.txt
report-item/start "Romano"
sorted-data: []
parse/all data [
some [
copy num [any " " to " "]
copy rest thru newline
(insert insert tail sorted-data num rest)
]
]
sorted-data: sort/skip sorted-data 2
report-item/end "Romano"
write %sorted-data-romano.txt sorted-data
unset 'sorted-data
recycle
;; Romano -- parse sort int
;; -------------------
data: read %../public/www.pusatberita.com/test.txt
report-item/start "Romano-int"
blk: []
parse/all data [
some [
h: any " " copy num integer!
:h copy rest thru newline
(insert insert tail blk to integer! num rest)
]
]
blk: sort/skip blk 2
report-item/end "Romano-int"
sorted-data: copy ""
foreach [x x2] blk [insert tail sorted-data x2]
write %sorted-data-romano-int.txt sorted-data
unset 'sorted-data
recycle
; for next texts:
data: read/lines %../public/www.pusatberita.com/test.txt
-----end of code ----
---
Ciao
Romano