Page 3 of 5

Re: Performance questions

Posted: Tue Oct 04, 2011 9:45 pm
by TechnoCat
tentus wrote:
Wombat wrote: And it made NO difference when i used this code structure:
...

Code: Select all

function love.update()
function love.draw()

--all the code

end
end
I hate to say it, but that simply cannot be true. Something is horribly wrong in the method of your testing if putting draw inside of update gives you the same results as having them separate.
haha yeah.
excerpt from love.run:

Code: Select all

        if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled
        if love.graphics then
            love.graphics.clear()
            if love.draw then love.draw() end
        end

Re: Performance questions

Posted: Tue Oct 04, 2011 10:29 pm
by Wombat
Do anyone understand why the program i made do those crazy thinks i wrote in my last posts?^^

I realy don´t know what´s going on. When i do things that should make the code faster, nothing happens. If edit the code in a horrible way, it just runs faster...

I don´t understand this world i am livning in :D :D :D

Re: Performance questions

Posted: Tue Oct 04, 2011 10:34 pm
by Ensayia
Once again, provide us with the code in a .zip or .love format so we can look at it. If you do not want to share your code there is very little we can do to help you.

Re: Performance questions

Posted: Wed Oct 05, 2011 5:18 am
by Wombat
My Code has around 2000 Lines. Is that a Problem?

Re: Performance questions

Posted: Wed Oct 05, 2011 6:22 am
by kikito
For uploading, no.

For understanding it, it depends on how it is organized.

Definitively, upload it.

Re: Performance questions

Posted: Wed Oct 05, 2011 7:22 am
by miko
Wombat wrote:I tested my Programm on 3 PC´s: 2 Dual Core and 1 Single Core One.

I found out that my game runs always very, very smoothie on the 2 dual core pc´s and always bad on the single core.
I would say that this is the OS problem. Are you using an antivirus software, or other resource-demanding task? Check disk/CPU usage while running your game (and while not running it).

Re: Performance questions

Posted: Wed Oct 05, 2011 7:24 am
by Robin
One thing about defining love.draw inside love.update:

The problem isn't performance. The problem is that it is completely useless.

What if you saw the following code:

Code: Select all

function something()
   local i = 0
   i = 309
   i = 0
   -- some more code
end
What would you do? You would remove the two lines that changed i without changing the meaning of the code, right?

And if we see

Code: Select all

function love.update(dt)
   function love.draw()
     -- drawing code
   end
   -- updating code
end
We change it to

Code: Select all

function love.update(dt)
   -- updating code
end

function love.draw()
   -- drawing code
end
because that makes more sense.

Re: Performance questions

Posted: Wed Oct 05, 2011 7:30 am
by Wombat
Ok i attachet my code below. ^^

Re: Performance questions

Posted: Wed Oct 05, 2011 8:21 am
by Robin
Please include your whole project, not just your main.lua. :)

Re: Performance questions

Posted: Wed Oct 05, 2011 8:55 am
by kraftman
You really need to add some formatting to that.