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

Author Topic: Visual Studio Debug/Release Issues  (Read 1519 times)

0 Members and 1 Guest are viewing this topic.

lawsonk

  • Newbie
  • *
  • Posts: 1
    • View Profile
Visual Studio Debug/Release Issues
« on: October 17, 2016, 04:01:17 am »
I used SFML to create a graphical rendering of the classic Traveling Salesman Problem, which would be solved used a Genetic Algorithm.

Using the debug build version I find that the program runs as expected, albeit at a very low frame rate.
https://www.youtube.com/embed/LYPndQ5kdmo

However using the release build version I find that the counter I used to display the current generation climbs very quickly and that the framerate is no longer limited. It seems almost like part of the code is being skipped so the frame can finish as soon as possible.


If you notice the generation counter doesn't appear to match the redrawing of the tours.

I've tried setting the optimization setting for release to disabled, however, that doesn't change anything. Nor do I think it has anything to do with the included sfml-xxx.dll files.


My Debug Folder


My Release Folder


I'm using SFML 2.3.2

Frames are locked using ...
window.setFramerateLimit(60);

This following two snippets of code should only run once per frame.
Although I have my doubts that this is the cause of the issue.
if (!paused)
                {
                        generations++;
                        textDisplayHandler.editText(3, "Generations: " + std::to_string(generations));
                        geneticAlgorithm.setTourReference(tourHandler.getTourReference());
                        geneticAlgorithm.generateTours();
                }

renderHandler.Draw();
 
// Draw Definition
void RenderHandler::Draw()
{
        rw_->clear();
        tour_->drawTours();
        text_->drawText();
        city_->drawCities();
       
        rw_->display();
}
 

Anyone have any idea why there might be such a discrepancy between the two build versions?

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: Visual Studio Debug/Release Issues
« Reply #1 on: October 17, 2016, 05:19:19 am »
1) Use the same framerate limit on the two versions.
2) Use a delta-time based counter, not a generic frame counter.
3)If you want to show code, show a more appropriate code, the two snippets of code show us *nothing*.
I would like a spanish/latin community...
Problems building for Android? Look here