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

Author Topic: SFML and pagefaults  (Read 1032 times)

0 Members and 1 Guest are viewing this topic.

jeremiawuzza

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
SFML and pagefaults
« on: July 11, 2015, 07:59:06 am »
Hi there SFML team
Is there any reason why I should be getting 45000 page faults and 430 cache faults per second running a simple SFML program? I am using a 64 bit i5 with 8 m ram running codeblocks, mingw 4.7.1 and SFML 2.3.
"ordinary" C++ programs don't do this, even the most complex I have tried.
I am pretty sure I have all my link libraries set up properly, as well as path variables etc. Anyway the programs in SFML I have been making all compile and run.
This is the simple program that I used to test:
void testpagefaults()
{
sf::RenderWindow window;
window.create(sf::VideoMode(200,200), "PF Map");
sf::CircleShape circle(20);
circle.setOrigin(20,20);
circle.setPosition(100,100);

    // run the main loop
    while (window.isOpen())
    {
        // handle events
        sf::Event event;
        while (window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window.close();
        }

        // draw the map
        window.clear();
       window.draw(circle);
        window.display();
    }

}

Has anybody any idea what could be causing this? And do I need to worry about it?

cheers
Jeremy

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML and pagefaults
« Reply #1 on: July 11, 2015, 10:21:35 am »
Instead of measuring those values, just look at the "real" performance (i.e. how many frames get completed per second) arriving in your application. Paging is a complicated topic, and there can be many reasons for a high page fault value. If it doesn't matter anyway, then you can just ignore it. Your code example is so simple that using it to perform any performance tests doesn't really provide any reliable results anyway. Build something bigger or more complete and then measure performance once you are done.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML and pagefaults
« Reply #2 on: July 11, 2015, 11:33:30 am »
I agree completely with binary1248 - don't worry about it unless you have an actual performance problem.
However, if I was to make a guess as to the reason then I'd say that you probably didn't build with optimization enabled.
« Last Edit: July 11, 2015, 11:39:25 am by Jesper Juhl »