Hi,
I just wrote a little program using SFML and profiled it, because it was lagging a bit. The profiler said the 20% of the time is spent in sf::Window::pollEvent. I found out that the slow part of it is in sf::prov::JoystickImpl::isConnected. In that function, there is an ostringstream created everytime it is called (42% of the time in that function is spent in std::basic_ios<>::init), so I tried replacing JoystickImpl::isConnected with the following code:
bool JoystickImpl::isConnected(unsigned int index)
{
char filename[13 /* For /dev/input/js */ + std::numeric_limits<unsigned int>::digits10 + 1 /* Null termination */];
std::sprintf(filename + 13, "/dev/input/js%u", index);
struct stat info;
return stat(filename, &info) == 0;
}
With this modification the lags disappeared. But with that change, the user would have to install the sfml libraries with the changed code too. So, is there any way to just disable joystick support in SFML? I don't need it.