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/LYPndQ5kdmoHowever 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?