From 57a005ff3e65e131f95686b96230120f198ac9bd Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 26 Dec 2016 01:24:35 +0100 Subject: [PATCH] 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. --- Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index 58f92f29a4..bb29e216cd 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -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(devnode); if (input->IsInteresting()) { g_controller_interface.AddDevice(std::move(input)); + std::string name = GetName(devnode); s_devnode_name_map.insert(std::pair(devnode, name)); } }