Computer Science Canada View.Update Vs View.UpdateArea |
Author: | copthesaint [ Mon Jan 30, 2012 10:39 am ] | ||
Post subject: | View.Update Vs View.UpdateArea | ||
I realise I did make a thread like this in the past however I feel its very useful with this way of testing. I originally I thought "well View.update and View.Update Area cant be a big enough difference in speed" however from testing View.Update I found out that View.Update is equivalent to View.UpdateArea (-2.-2.maxx+2,maxy+2), simply by using View.UpdateArea(0,0,maxx,maxy) you reduce the time it takes to use View.update which on my computer is approx: 0.51 ms to about 0.41ms (about 20% faster). How much time do you save? well for 100 loops you would save 10ms approx. in runtime. The reason why I am posting this is because I myself am trying to get some extra fps from my program.
|
Author: | DemonWasp [ Mon Jan 30, 2012 12:13 pm ] | ||||||||
Post subject: | RE:View.Update Vs View.UpdateArea | ||||||||
Hmm. Interesting. I tried this:
And got this:
It looks like View.Update() can determine whether it should bother updating or not (have you drawn anything since it was last called?) while View.UpdateArea doesn't do anything of the sort. If I force it to actually do the update...
...then I get:
Presumably the extra time taken by View.Update() is involved in checking whether it needs to do the relatively-expensive "actually update" operation. |
Author: | mirhagk [ Mon Jan 30, 2012 1:06 pm ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
Interesting find Demonwasp, but I feel like that should just be a compiler optimization. Perhaps that should be looked at in OpenTuring. |
Author: | copthesaint [ Mon Jan 30, 2012 4:14 pm ] | ||||||
Post subject: | Re: RE:View.Update Vs View.UpdateArea | ||||||
DemonWasp @ Mon Jan 30, 2012 wrote: Hmm. Interesting. I tried this:
And got this:
It looks like View.Update() can determine whether it should bother updating or not (have you drawn anything since it was last called?) while View.UpdateArea doesn't do anything of the sort. If I force it to actually do the update... No View.Update cannot. You just dont have a put call before you used View.Update. thus the screen wasnt even set to visible. When you put the view.update time then it calls the screen to be visable, so view.update area then updates the newly visable screen. You would get the same results if you but View.UpdateArea before View.Update. DemonWasp @ Mon Jan 30, 2012 wrote:
epic |
Author: | DemonWasp [ Mon Jan 30, 2012 4:57 pm ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
Ah, yes, that's correct. That leaves me pretty confused though: why would View.Update() be slower than View.UpdateArea(0,0,maxx,maxy)? Seems...wrong. I mean, I would imagine that View.Update() will just call View.UpdateArea(0,0,maxx,maxy), but that wouldn't explain why it's slower. |
Author: | copthesaint [ Mon Jan 30, 2012 5:01 pm ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
well, my prediction is that view.update() calls view.updatearea (-2,-2,maxx+2,maxy+2) or something more ridiculous like that. |
Author: | mirhagk [ Tue Jan 31, 2012 9:19 am ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
Or just the extra function call is that little discrepancy. |
Author: | crossley7 [ Tue Jan 31, 2012 1:09 pm ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
I believe I saw an older thread that explains this. I have no idea where to look for it, but I believe this was found because View.UpdateArea had been optimized prior to development being stopped for Turing while View.Update had not. Then again, if that runtime is so close for the 2 pixels larger, it may be updating a screen that is just larger than the displayed screen |
Author: | evildaddy911 [ Mon Feb 20, 2012 4:16 pm ] | ||
Post subject: | Re: View.Update Vs View.UpdateArea | ||
I thought that View.Update updates (-maxint,-maxint,maxint,maxint), but...
OUTPUT: Quote: Update:14465
UpdateArea:15140 |
Author: | Aange10 [ Mon Feb 20, 2012 5:51 pm ] | ||
Post subject: | RE:View.Update Vs View.UpdateArea | ||
I'd like to put this out (the same testing, but in a more controlled envrionment)
I noticed at 1000 reps, the last View.UpdateArea is consistently the fastest, however at 10,000 reps it becomes slightly inferior to the first View.UpdateArea. However all tests showed View.Update to be slower. I'd try tweaking the parameters of the last View.UpdateArea until you found a number that found a consistent match (or write a program to do it) |
Author: | Dreadnought [ Tue Feb 21, 2012 12:35 am ] |
Post subject: | Re: View.Update Vs View.UpdateArea |
Aange10 wrote: I noticed at 1000 reps, the last View.UpdateArea is consistently the fastest
I could not reproduce this consistently, (though it did happen at least 1 out of 5 times when I ran the program). However, if I reverse the order of Aange10's tests, the "last View.updateArea" is the worst by a significant margin, and View.Update and View.UpdateArea(0,0,maxx,maxy) have run times within ~4% of each others. (with View.Update winning about half the time) Note that these are my own results, but I feel they are sufficient to show that these tests have obvious flaws. |
Author: | Aange10 [ Tue Feb 21, 2012 5:25 pm ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
Quote: but I feel they are sufficient to show that these tests have obvious flaws. Indeed. Solution? I was thinking about writing a program to take the time of 10,000 executions of View.Update and View.UpdateArea (0,0,maxx,maxy), and have the prgoram find out what parameters fit into View.UpdateArea () that makes its runtime = View.Update. Any major flaws that would discourage this experiment? |
Author: | mirhagk [ Tue Feb 21, 2012 7:24 pm ] |
Post subject: | RE:View.Update Vs View.UpdateArea |
Shut down every service on your computer and kill every process you can, also compile the code into an exe before you run it (make sure you have the options either be command line arguments or as get statements at the start of the program). Really the difference is moot, but I don't think View.UpdateArea is really significantly faster. |
Author: | Dreadnought [ Tue Feb 21, 2012 7:24 pm ] |
Post subject: | Re: View.Update Vs View.UpdateArea |
I certainly encourage any further testing. From what I have seen so far View.UpdateArea(0,0,maxx,maxy) appears to be about 5% faster. However the run times fluctuate quite a bit so I'm not sure I can say anything conclusive. I suggest that if you want to test the two (or more) functions, you should give them they're own programs that are as similar as possible, this should avoid any oddities pertaining to the order of tests (like in your previous tests). Also, make sure you average over a couple tests (perhaps at least once use a freshly booted PC), especially if you're going to attempt to match run times of different functions. That's all I got right now, I feel like I know too little of what is actually going on (like what does Turing compile these functions to). Good luck! |
Author: | copthesaint [ Sun Mar 04, 2012 11:29 pm ] | ||
Post subject: | Re: View.Update Vs View.UpdateArea | ||
I made one final program that I believe will give the most accurate results and overall when I ran the program at 1000 tests at graphics 800x600 View.UpdateArea would run 0.035 ms aprox. faster which isnt alot but you save that every time your program runs a loop and every time I ran it, it was always faster then View.Update. Its probably just a difference in how it is called, since View.Update has to go fetch the dimentions its self while View.UpdateArea (x1,y1,x2,y1 : int) is already specified and thus only has to update it.
|