Re: controller time
jon klein <[email protected]> Sat, 24 Sep 2005 21:58:10 -0400
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
--===============00036601540252245712== Content-Type: multipart/alternative; boundary=Apple-Mail-1--1017564907 --Apple-Mail-1--1017564907 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 24, 2005, at 6:51 PM, Anand Veeraswamy wrote: > Hi, > > In the iterate method of the main controller class I do the > following... > > I print the controller time and then call a computationally > intensive function and then print the controller time again. > > Since the function that I call is computationally quite intensive I > can notice that sometimes it takes a while for the display to occur. > > But still the controller time before the function call and after > the function call are the same. Why does that happen?? I also tried > using > self schedule method-call. That did not solve my problem either. > > Actually I have implemented 2 different algorithms to find paths. > One without using heuristics and one using heuristics and I want to > prove that the algorithm using heuristics takes less time. What is > the best way of doing this? I think there are two different issues here. The first is that in order for the simulation time to update properly, you'll need to call "super iterate" at the end of your controller's iterate method. More importantly, though, you probably don't want to be using simulation time to check how long an algorithm is taking. You'll actually want to be checking the "real time" that the algorithm took. The real time is the actual clock time elapsed while the algorithm is executing. The "simulation time" steps forward with each iteration of the "iterate" method, so both algorithms would in fact take the same amount of time. Use the Control class method "get-real-time" to get the real time before and after your algorithms run. - jon klein --Apple-Mail-1--1017564907 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Sep 24, 2005, = at 6:51 PM, Anand Veeraswamy wrote:</DIV><BR = class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"> = <DIV><FONT face=3D"Arial" size=3D"2">Hi,</FONT></DIV> <DIV><FONT = face=3D"Arial" size=3D"2"></FONT>=A0</DIV> <DIV><FONT face=3D"Arial" = size=3D"2">In the iterate method of the main controller class I do the = following...</FONT></DIV> <DIV><FONT face=3D"Arial" = size=3D"2"></FONT>=A0</DIV> <DIV><FONT face=3D"Arial" size=3D"2">I print = the controller time and then call a computationally intensive function = and then print the controller time again.</FONT></DIV> <DIV><FONT = face=3D"Arial" size=3D"2"></FONT>=A0</DIV> <DIV><FONT face=3D"Arial" = size=3D"2">Since the function that=A0I call is computationally quite = intensive I can notice that sometimes it takes a while for the display = to occur.</FONT></DIV> <DIV><FONT face=3D"Arial" size=3D"2"></FONT>=A0</DI= V> <DIV><FONT face=3D"Arial" size=3D"2">But still the controller time = before=A0the=A0function call and after the function call are the same. = Why does that happen?? I also tried using </FONT></DIV> <DIV>self = schedule method-call. That did not solve my problem either.</DIV> = <DIV>=A0</DIV> <DIV><FONT face=3D"Arial" size=3D"2">Actually I have = implemented 2 different algorithms to find paths. One without using = heuristics and one using heuristics and I want to </FONT></DIV> = <DIV><FONT face=3D"Arial" size=3D"2">prove that the algorithm using = heuristics takes less time. What is the best way of doing = this?</FONT></DIV></BLOCKQUOTE><DIV><BR = class=3D"khtml-block-placeholder"></DIV>I think there are two different = issues here.=A0=A0</DIV><DIV><BR = class=3D"khtml-block-placeholder"></DIV><DIV>The first is that in order = for the=A0simulation time to update properly, you'll need to call "super = iterate" at the end of your controller's iterate method.</DIV><DIV><BR = class=3D"khtml-block-placeholder"></DIV><DIV>More importantly, though, = you probably don't want to be using simulation time to check how long an = algorithm is taking.=A0 You'll actually want to be checking the "real = time" that the algorithm took.=A0 The real time is the actual clock time = elapsed while the algorithm is executing.=A0 The "simulation time" steps = forward with each iteration of the "iterate" method, so both algorithms = would in fact take the same amount of time.=A0</DIV><DIV><BR = class=3D"khtml-block-placeholder"></DIV><DIV>Use the Control class = method "get-real-time" to get the real time before and after your = algorithms run.</DIV><DIV><DIV><BR = class=3D"khtml-block-placeholder"></DIV><DIV>- jon = klein</DIV><BR></DIV></BODY></HTML>= --Apple-Mail-1--1017564907-- --===============00036601540252245712== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ breve mailing list [email protected] http://lists.spiderland.org/mailman/listinfo/breve --===============00036601540252245712==--