evdev: reduce startup time

GetName() creates a new evdev device which calls tons of ioctls. But the
main culprit is close() which for input devices appears to be a slow
path in the kernel.

This commit reduces PopulateDevices() by 50% on my laptop, but ~730 ms
is still ridiculously slow for something that isn't needed right away.
This commit is contained in:
Tillmann Karras 2016-12-26 01:24:35 +01:00
parent 8c99f60026
commit 57a005ff3e
1 changed files with 1 additions and 1 deletions

View File

@ -175,12 +175,12 @@ void PopulateDevices()
{
// Unfortunately udev gives us no way to filter out the non event device interfaces.
// So we open it and see if it works with evdev ioctls or not.
std::string name = GetName(devnode);
auto input = std::make_shared<evdevDevice>(devnode);
if (input->IsInteresting())
{
g_controller_interface.AddDevice(std::move(input));
std::string name = GetName(devnode);
s_devnode_name_map.insert(std::pair<std::string, std::string>(devnode, name));
}
}