Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Debugging is slow at first. then speeds up  (Read 2578 times)

0 Members and 1 Guest are viewing this topic.

werdy666

  • Newbie
  • *
  • Posts: 5
    • View Profile
Debugging is slow at first. then speeds up
« on: February 02, 2012, 06:46:09 am »
Hi,

I am using SFML 2.0 (downloaded 12th January 2012)

What I am finding is that when i first run my program in vs2010 i am getting really low frame rates, in the vicinity of no more than 10fps.

after afew minutes of this it all of a sudden go back to the normal fps of around 100fps.

I am drawing a tilemap with sprites approx 961 onto a rendertexture.
which then gets displayed each frame onto the screen.

I have tried using a profiler called very sleepy which indicates that 90% of the time the new and delete operators are being called in SFML-Graphics-d.dll

I don't understand why at first it runs slow then speeds up after time. I personally can run it, and leave the computer and it goes fast.

One other thing I have noticed is that if I run the perfomance profiler in VS2010, it runs at 100fps straight away. if i then run it again through debug, it starts out at 8fps...


any hints or tips would be gratefully accepted! maybe this is a known problem I haven't come across in the forums??

Thanks

werdy666 :twisted:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Debugging is slow at first. then speeds up
« Reply #1 on: February 02, 2012, 07:57:09 am »
This seems to be a common problem, but it's probably a driver issue. I mean, there is no such code in SFML
Code: [Select]
if (debug && (elapsedTime < 10))
    runSlow();
else
    runFast();
Laurent Gomila - SFML developer

werdy666

  • Newbie
  • *
  • Posts: 5
    • View Profile
Debugging is slow at first. then speeds up
« Reply #2 on: February 02, 2012, 12:07:47 pm »
Quote from: "Laurent"
This seems to be a common problem, but it's probably a driver issue. I mean, there is no such code in SFML
Code: [Select]
if (debug && (elapsedTime < 10))
    runSlow();
else
    runFast();


Lets hope there is no code in there like that! :)

I updated to the latest Nvidia drivers, also updated to the latest SFML 2.

one thing i did notice is this bit of code....

Code: [Select]

oss << playeronehealth;
GameText.SetString(oss.str());
GameText.SetPosition(1100,420);
App.Draw(GameText);
oss.str("");
oss << playeronescore;
GameText.SetString(oss.str());
oss.str("");
GameText.SetPosition(1100,440);
App.Draw(GameText);


if i comment that out it does sit on 100+ fps.

with it in there it sits on 8fps...

This code runs every frame. Is the StringStream that heavy to destroy my framerate???

thanks

Werdy666 :P  :?

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Debugging is slow at first. then speeds up
« Reply #3 on: February 02, 2012, 12:14:15 pm »
Try it by removing those oss lines and setting constant strings.
If your framerate goes up to 100 again, you got your answer. :)
JSFML - The Java binding to SFML.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Debugging is slow at first. then speeds up
« Reply #4 on: February 02, 2012, 12:18:29 pm »
Quote
Is the StringStream that heavy to destroy my framerate???

No it's not. And it wouldn't explain that the FPS goes back to normal after a few minutes.

I think it's commenting the Draw calls that removes the issue.
Laurent Gomila - SFML developer

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Debugging is slow at first. then speeds up
« Reply #5 on: February 04, 2012, 03:57:30 pm »
Its something with the drivers. Same happens on my Nvidia GTX 295 (slow down first time a day I run something SFML; couldn't test other OpenGL stuff yet) and it goes away after 30-60 seconds with no apparent and visible reason. Doesn't happen on my Eee PC, so shouldn't be a direct/generic SFML(2) issue. Maybe there's some coincidence interfering with SFML in combination with the drivers, but would still be weird. Also this doesn't seem to be related to debug builds as for me it happens with release builds too.

Also: I start the program, it runs with 2-3 fps. I close it immediately. I wait 2 minutes, start it, and fps is fine. So VERY unlikely it's something in the program/game code (as that definitely isn't active between the calls).

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Debugging is slow at first. then speeds up
« Reply #6 on: February 14, 2012, 01:26:22 pm »
Just wanted to mention that the new beta drivers from January 31st solved this issue for me (although some of my DirectX games now crash on startup :S).

netrick

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: Debugging is slow at first. then speeds up
« Reply #7 on: August 21, 2012, 01:16:58 pm »
Its something with the drivers. Same happens on my Nvidia GTX 295 (slow down first time a day I run something SFML; couldn't test other OpenGL stuff yet) and it goes away after 30-60 seconds with no apparent and visible reason. Doesn't happen on my Eee PC, so shouldn't be a direct/generic SFML(2) issue. Maybe there's some coincidence interfering with SFML in combination with the drivers, but would still be weird. Also this doesn't seem to be related to debug builds as for me it happens with release builds too.

Also: I start the program, it runs with 2-3 fps. I close it immediately. I wait 2 minutes, start it, and fps is fine. So VERY unlikely it's something in the program/game code (as that definitely isn't active between the calls).

Sorry for writing in old topic, but that's exactly the problem that I have and I don't want to make a new topic. So my game is compiled as release, with release sfml 2.0 static libs. My gpu is radeon 6870 with newest drivers. So after boot up, starting my application for the first means that my fps is 2-20, well very slow. Sometimes it goes back to normal after 20-60sec (250 fps or 60 with vsync), but sometimes it doesn't. The second and every next run always DOES NOT have the problem. It doesn't matter if I boot up and start my app immediately or if I wait 2 hours before I run it. I run it directly from clicking .exe. I don't think that  it's my code issue because the problems seems to be known in SFML, and after first time fps is extremely good since second and every next launch of my application. It may be something related to sfml and/or drivers, but it's very hard to tell what's the reason.
Could you test it by yourself? Reboot your PC and don't run any SFML/OpenGL related app and run it, and see if you have slow fps for the first second. It should run 60 fps on any reasonable gpu. And reboot it, after logging out and in the problem isn't present (it's strange too).


http://wikisend.com/download/884038/bug%20test.zip (no waiting etc, instant download)

Here's windows .exe. FPS is shown at top left corner (black font). Normal fps without bug should be 60 on basically any PC. If you have fps 2-20 (maybe a bit higher if you have top tier hardware) for the first run, and smooth 60 for the next, it means the bug is present on your pc. Thanks.
« Last Edit: August 21, 2012, 01:18:42 pm by netrick »