
-----------------------------------
giuseppe105
Tue Oct 27, 2009 3:00 pm

speed comparison
-----------------------------------
Is it faster to draw an image with the JLabels paint method or check an if statement?

I'm leaning towards the if statement.

even if the if statement is faster i'm still using the paint method would that change the answer?

-----------------------------------
DemonWasp
Tue Oct 27, 2009 3:08 pm

RE:speed comparison
-----------------------------------
I would assume that the if statement will execute sufficiently fast and be false sufficiently frequently that using it to skip the draw will improve speed. However...


As a thought experiment, assume that the if-execution takes F time and the image-draw takes D time. Assume that the if statement evaluates to true P portion of the time ( 0 