Hi! I hope correctly has understood what are you about, so what I get:
alias hash {
hmake test 10
var %x = 0
var %ms = $ticks
while (%x < 1000) {
hadd test %x 0
inc %x 1
}
echo -s end(hadd test) (time elapsed: $calc(($ticks - %ms) / 1000) secs)
hfree test
}
alias _var {
var %x = 0
var %ms = $ticks
while (%x < 1000) {
set %test_ $+ %x 0
inc %x 1
}
echo -s end(setvar test) (time elapsed: $calc(($ticks - %ms) / 1000) secs)
unset %test_*
}
alias file {
var %x = 0
var %ms = $ticks
while (%x < 1000) {
write test.txt 0
inc %x
}
echo -s end(filewrite test) (time elapsed: $calc(($ticks - %ms) / 1000) secs)
write -c test.txt
}
results are as follows:
hash tables: 0.1 - 0.12 seconds
variables: 0.35 - 0.38 seconds
fwrite: ~8.5 seconds
It shows that the hash tables realy are faster (about 3x times faster that the /set command, and fwrite totally sucks).