 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Tue Oct 14, 2008 7:22 am
[2.36] records - hash tables not working |
repost so you guys can test too, same thing goes for string lists
test tools:
#AL t10k {$a=@timesz;#LOO 10000 {#EXE %-1};#SA 10k: (@timesz-$a)}
#VARF timesz {%eval(%time(s)*1000+%time(z))}
tmp=%null;#LOO 100 {#ADDK tmp %i (100-%i)}
t10k #no %iskey(@tmp,1) <-repeat tests to get idea of stdev
t10k #no %iskey(@tmp,100)
#sort tmp
t10k #no %iskey(@tmp,1)
t10k #no %iskey(@tmp,100)
#sort tmp 0
t10k #no %iskey(@tmp,1)
t10k #no %iskey(@tmp,100)
t10k #no %iskey(@tmp,33)
try same stuff with %db, %isvalue or any other read operation
see any difference? i dont, unless we talk zmud vs cmud
iskey 1: 1400~ms on z vs 3200~ms on c
iskey 100: 2500~ms vs 3200~ms |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Oct 14, 2008 10:32 am |
A few small problems with your test. First is the use of #EXEC, it requires that the code following it be compiled, then executed. zMud executed script as it was parsed. You test by using #EXEC favors zMud.
Second is the use of #NOOP, in CMud this command is run in the primary system thread, and its parameters are examined at runtime instead of compile time. #CALL on the other hand examines its parameters at compile time and determines whether it will need to run in the primary thread. If it finds it was wrong while executing then it elevates. #CALL is always a better choice in CMud.
Changing your test to actually use CMud gives some very pleasent results.
| Code: |
#AL t10k {$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,1)};#SA 10k: (%secs-$a)
$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,100)};#SA 10k: (%secs-$a)
#sort tmp
$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,1)};#SA 10k: (%secs-$a)
$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,100)};#SA 10k: (%secs-$a)
#sort tmp 0
$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,1)};#SA 10k: (%secs-$a)
$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,100)};#SA 10k: (%secs-$a)
$a=%secs;#LOO 10000 {#CALL %iskey(@tmp,33)};#SA 10k: (%secs-$a)}
tmp=%null;#LOO 100 {#ADDK tmp %i (100-%i)}
t10k |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Tue Oct 14, 2008 10:54 am |
uuh, all this should be in the reference manual! thanks
indeed, stringlists work noticeably better with call as well, and sorting of them works too...
solved, cheers! |
|
|
|
 |
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Tue Oct 14, 2008 12:23 pm |
From the online manual:
| Quote: |
Does nothing! (Wow, what a powerful command). Actually, it *does* expand its parameters, so its a useful way to execute a function and throw away the result
See the #CALL command for a better way to execute function calls. |
The reference manual is just that, a reference. What I think you mean is that it would be nice to have this mentioned more directly as a change for zMUD users and not just in the command reference. |
|
|
|
 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Tue Oct 14, 2008 1:28 pm |
well no, actually reference manual should contain ALL important information, and id consider how and when parameters are processed important, only relevant hint of difference is in #call reference " Use instead of #NOOP for executing functions." wo any further explanation
|
|
|
|
 |
Tarn GURU
Joined: 10 Oct 2000 Posts: 875 Location: USA
|
Posted: Tue Oct 14, 2008 2:07 pm |
| Vijilante wrote: |
Second is the use of #NOOP, in CMud this command is run in the primary system thread, and its parameters are examined at runtime instead of compile time. #CALL on the other hand examines its parameters at compile time and determines whether it will need to run in the primary thread. If it finds it was wrong while executing then it elevates. #CALL is always a better choice in CMud.
|
Is there some subtle difference between them? The only things I've ever used #NOOP for were discarding results of a function and commenting, and #CALL seems to do both of those just fine.
If they're functionally equivalent but #CALL is always faster, then why does the compiler treat them differently?
-Tarn |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Tue Oct 14, 2008 7:17 pm |
In zMud they were the exact same. CMud made a distinction between them. As far as I can tell #CALL is always superior.
Also comments should be done using // at the start of the line instead of #NOOP, this is because the comment will not become part of the compiled script. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Tarn GURU
Joined: 10 Oct 2000 Posts: 875 Location: USA
|
Posted: Wed Oct 15, 2008 1:37 am |
| Vijilante wrote: |
In zMud they were the exact same. CMud made a distinction between them. As far as I can tell #CALL is always superior.
Also comments should be done using // at the start of the line instead of #NOOP, this is because the comment will not become part of the compiled script. |
Yes, using NOOP for comments goes many years back- of course I use // now.
If they're truly the same, then maybe it's time to retire #NOOP (routing it to #CALL in the compiler, or as a straight comment if there's no useful work to be done in the arguments).
-Tarn |
|
|
|
 |
|
|
|