Hello, Rebols,
did anyone notice the time differences like this?:
>> st/start a: empty-il for i 1 20000 1 [a: prepend i a] st/stop
== 0:00:03
>> st/start a: copy [] for i 1 20000 1 [insert a i] st/stop
== 0:01:36
NB Insert is native as opposed to Prepend written in Rebol
the code follows:
; An empty IL
empty-il: make object! [
;Private elements, do not touch!
what: nxt: none
]
; Basic manipulations
il-empty?: func [il] [none? il/nxt]
il-first: func [il] [
either il-empty? il [
print {Error, trying to get the first element of an empty
IL.}
halt
] [il/what]
]
prepend: func [elem il] [
make empty-il [what: elem nxt: il]
]
il-next: func [il] [
either il-empty? il [
print {Error, trying to shorten an empty IL.} halt
] [il/nxt]
]
; stopwatch with multiple timings
st: make object! [
times: empty-il
start: func [] [times: prepend now/time times]
stop: func [/local t] [
t: now/time - il-first times
times: il-next times
t
]
clear: func [] [times: empty-il]
]
- [REBOL] how to create a hidden or encrypted script? Re:(3... mbehar
- [REBOL] how to create a hidden or encrypted script? Re:(4... news . ted
- [REBOL] how to create a hidden or encrypted script? Re:(4... joel . neely
- [REBOL] how to create a hidden or encrypted script? Re:(5... news . ted
- [REBOL] how to create a hidden or encrypted script? Re:(6... joel . neely
- [REBOL] how to create a hidden or encrypted script? Re:(5... strejcek
- [REBOL] how to create a hidden or encrypted script? Re:(6... joel . neely
- [REBOL] how to create a hidden or encrypted script? Re:(7... robert . muench
- [REBOL] how to create a hidden or encrypted script? Re:(8... joel . neely
- [REBOL] how to create a hidden or encrypted script? Re:(2... Petr . Krenzelok
- [REBOL] Re: Evaluation Re:(14) lmecir
- [REBOL] Re: Evaluation Re:(14) giesse
- [REBOL] Re: Evaluation Re:(12) giesse
- [REBOL] Evaluation Re:(14) joel . neely
- [REBOL] Evaluation Re:(14) lmecir
- [REBOL] Evaluation Re:(13) news . ted
- [REBOL] Re: Evaluation Re:(13) ejolson
- [REBOL] Wiki Wiki? Michael_Chean
- [REBOL] Wiki Wiki? Re: Al . Bri
- [REBOL] Wiki Wiki? Re:(2) Michael_Chean
- [REBOL] Wiki Wiki? Re:(2) Michael_Chean
