This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
ComputerTech
Master
Posts: 399 Joined: Sat Feb 22, 2020 10:29 am
Contact:
Post
by ComputerTech » Wed Mar 10, 2021 2:11 pm
So is this a good/best way to test the proc speed?
Code: Select all
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
ComputerTech
Master
Posts: 399 Joined: Sat Feb 22, 2020 10:29 am
Contact:
Post
by ComputerTech » Wed Mar 10, 2021 5:03 pm
thanks willyw, appreciate it
ComputerTech
ComputerTech
Master
Posts: 399 Joined: Sat Feb 22, 2020 10:29 am
Contact:
Post
by ComputerTech » Fri Mar 12, 2021 3:21 pm
Just thought i'd post my finished working proc speed test code
Code: Select all
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
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Sat Mar 13, 2021 7:10 am
The clock clicks should yield the same results.
Once the game is over, the king and the pawn go back in the same box.
ComputerTech
Master
Posts: 399 Joined: Sat Feb 22, 2020 10:29 am
Contact:
Post
by ComputerTech » Sat May 08, 2021 1:50 am
Just curious why the "time" command yields different milliseconds each time
Code: Select all
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
ComputerTech
CrazyCat
Revered One
Posts: 1305 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Sat May 08, 2021 4:15 am
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.
ComputerTech
Master
Posts: 399 Joined: Sat Feb 22, 2020 10:29 am
Contact:
Post
by ComputerTech » Sat May 08, 2021 4:07 pm
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
thanks in advanced
ComputerTech
CrazyCat
Revered One
Posts: 1305 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon May 10, 2021 2:51 am
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+M ... erformance