| |
| |
| |
|
Page: 1 2 3
Comments:
<0> % time {list [lindex $list $i]]} <0> 18 microseconds per iteration <1> run it multiple times <1> not just once :) <1> time {lrange $list $i $i} 1000 <2> thommey: #1177 (341 clicks) Tcl: 02:25 <1> possible it is slower because it needs to read out $i twice <1> I used "0" for testing <0> ok <0> i'm making it as lifelike as possible
<0> using all the variables i used in the proc <1> :) <1> new challenge: shorten the code to 200byte <1> :) <0> set list [list a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9];set i 6 <0> set avg(lrange) 0; set avg(list) 0 <0> for {set x 0} {$x < 100} {incr x} { incr avg(lrange) [lindex [time {lrange $list $i $i]}] 0] } <0> for {set x 0} {$x < 100} {incr x} { incr avg(list) [lindex [time {list [lindex $list $i]]}] 0] } <0> set avg(lrange) [expr {$avg(lrange) / 100.0}] <0> set avg(list) [expr {$avg(list) / 100.0}] <0> puts "lrange average is: $avg(lrange) microseconds per iteration\nlist+lindex average is: $avg(list) microseconds per iteration" <2> [GRiMMY]: #9 (483 clicks) Tcl: 6 <2> [GRiMMY]: #10 (229 clicks) Tcl: 0 <0> thats my speed test code <2> [GRiMMY]: #13 (278 clicks) Tcl: 0.0 <2> [GRiMMY]: #14 (290 clicks) Tcl: 0.0 <2> [GRiMMY]: #15 (stdout) lrange average is: 0.0 microseconds per iteration <2> [GRiMMY]: #15 (stdout) list+lindex average is: 0.0 microseconds per iteration <1> #rename rename r <1> #r proc p <1> #r set s <1> ;) <0> lrange average is: 0.0 microseconds per iteration <0> list+lindex average is: 6.17 microseconds per iteration <0> and lrange is ALOT quicker <1> ha :) <0> and since its gonna be used over 10million times <0> that should shave off a bit of time <0> test time <0> woah! it took 3s longer <1> hm <0> thommey, know anything about C? <1> little bit <0> not enough then <0> lol <1> hehe <1> :)
<1> can't deal with lists <0> woulda showed ya a C library that does it in a few millisecs <1> too much pointer stuff <1> :) <1> hehe :) <3> =) <0> =) <0> why do C programmers never comment properly <1> lol <1> do YOU comment properly? <1> do you make weekly backups of your important data? <1> welcome to dreamland ;) <0> lol <1> internet explorer-coders seem to refuse comments too <1> sixth developer team or something like that gave up when trying to understand the core code <1> at least that's the rumor :) <0> lol <0> i actually comment fairly well <1> and the leaked w2k-source-part had more than 10 /* EVIL HACK */ in it <1> :) <1> and some insults <1> ;) <3> heh <4> u want comments? switch to java then :p <4> there's javadoc there <4> :) <1> http://en.wikiquote.org/wiki/Computers#Windows_2000_source_code <1> :) <0> hmph <1> there's some software for C-projects as well like that <1> ha <1> found the report on it <1> http://www.tfproject.org/tfp/archive/index.php/t-46375.html <1> and easier to read - version http://www.kuro5hin.org/story/2004/2/15/71552/7795 ;) <0> thommey, know python? <1> nah <1> tcl and vb only <1> :) <1> bit php, but that's nothing special <0> hmph <0> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 <0> looks like it would be quick
Return to
#tcl or Go to some related
logs:
#delphi #goal Whit3Wolf superscript directly above subscript microsoft word cmnn.ob quakenet+openbsd+channel #politics #politics #politics #politics
|
|