egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Best way to test Proc speed

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Wed Mar 10, 2021 2:11 pm    Post subject: Best way to test Proc speed Reply with quote

So is this a good/best way to test the proc speed?
Code:

bind PUB - "!test" speed:test

proc speed:test {nick host hand chan text} {
set start [clock clicks]
putquick "MODE $chan +o $nick"
set end [clock clicks]
puthelp "PRIVMSG $chan : Timespan: [expr ($end-$start)/1000.0]ms"
}


(Found this code from http://forum.egghelp.org/viewtopic.php?t=20784 | thanks to caesar)
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Mar 10, 2021 2:37 pm    Post subject: Re: Best way to test Proc speed Reply with quote

Check out:

http://www.tcl.tk/man/tcl8.6/TclCmd/time.htm

You'll find it interesting.

After that, you might like to visit:

https://www.tcl.tk/man/tcl8.5/tutorial/Tcl39.html

too.

I hope this helps.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Wed Mar 10, 2021 5:03 pm    Post subject: Reply with quote

thanks willyw, appreciate it Wink
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri Mar 12, 2021 3:21 pm    Post subject: Reply with quote

Just thought i'd post my finished working proc speed test code Laughing
Code:

bind PUB - "!speed" do:test

proc proc:name {nick host hand chan text} {
putserv "PRIVMSG $chan :foo"
}

proc do:test {nick host hand chan text} {
set foo [ time {proc:name $nick $host $hand $chan $text} 1]
set aoo [lindex [split $foo] 0]
set qoo "[expr {$aoo / 1000.00}]ms"
puthelp "PRIVMSG $chan :Proc Name : $tproc"
puthelp "PRIVMSG $chan :Proc Speed: $qoo"
}

_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Mar 13, 2021 7:10 am    Post subject: Reply with quote

The clock clicks should yield the same results.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat May 08, 2021 1:50 am    Post subject: Reply with quote

Just curious why the "time" command yields different milliseconds each time
Code:

125 microseconds per iteration
% time {puts "hello"} 1
hello
121 microseconds per iteration
% time {puts "hello"} 1
hello
126 microseconds per iteration
% time {puts "hello"} 1
hello
126 microseconds per iteration
% time {puts "hello"} 1
hello
126 microseconds per iteration
% time {puts "hello"} 1
hello
123 microseconds per iteration
% time {puts "hello"} 1
hello
92 microseconds per iteration
%


^^ on tclsh Razz
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Sat May 08, 2021 4:15 am    Post subject: Reply with quote

Just because the cpu could be used for other / different things and not 100% of the cpu (nor the same percentage) is dedicated to tclsh.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat May 08, 2021 4:07 pm    Post subject: Reply with quote

Okay, so what would be an alternative way to test proc speed and not rely on CPU ? would need exact 0.00seconds to compare different procs Razz

thanks in advanced
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon May 10, 2021 2:51 am    Post subject: Reply with quote

You can't.
"Proc speed" means nothing, it can only be compared to another one.

But you can use time with a greater number of iteration (I usually use 1000), it will give you an average speed which is more relevant

Edit: you can find short infos on https://wiki.tcl-lang.org/page/How+to+Measure+Performance
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Mon May 10, 2021 12:27 pm    Post subject: Reply with quote

Thanks CrazyCat Wink
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber