Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Tarn
GURU


Joined: 10 Oct 2000
Posts: 875
Location: USA

PostPosted: Mon Sep 29, 2008 5:05 pm   

Quick Comment on Speed
 
(not a problem report, just thought some of the people here might find it
interesting- CMud 3.0 and zMud 7.21)

I've been doing some math calc benchmarking and fired up CMud and zMud out of curiosity. This particular test was Euclid's algorithm, straight out of Sedgewick (not using the mod operator).

On a P4 1.7, zMud took about .22 or .23 seconds to run a sample problem. On the same machine, CMud manages about .03 seconds (for code which can run in both, which looks a little clumsy to get both parsers to accept it). CMud seems able to get down to around half that if you start using local variables and other tweaks.

-Tarn


base code, paste into new alias with name gcd:
#var start 1;#var end 1;#var start %time(z);#var u %1;#var v %2;#while (@u > 0) {#if (@u < @v) {t = @u;u = @v;v =@t;};#var u %eval(@u-@v)};#say "GCD:" @v , %eval(%time(z) - @start)

gcd 461952 116298
should display a correct answer of "18" and the time elapsed. If you see a negative time elapsed, that's because the second rolled over during the test.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net