{"action":"created","issue":{"url":"https://api.github.com/repos/WrinklyNinja/libloadorder/issues/24","labels_url":"https://api.github.com/repos/WrinklyNinja/libloadorder/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/WrinklyNinja/libloadorder/issues/24/comments","events_url":"https://api.github.com/repos/WrinklyNinja/libloadorder/issues/24/events","html_url":"https://github.com/WrinklyNinja/libloadorder/issues/24","id":118342764,"number":24,"title":"Improve performance when loading load order","user":{"login":"WrinklyNinja","id":2430738,"avatar_url":"https://avatars.githubusercontent.com/u/2430738?v=3","gravatar_id":"","url":"https://api.github.com/users/WrinklyNinja","html_url":"https://github.com/WrinklyNinja","followers_url":"https://api.github.com/users/WrinklyNinja/followers","following_url":"https://api.github.com/users/WrinklyNinja/following{/other_user}","gists_url":"https://api.github.com/users/WrinklyNinja/gists{/gist_id}","starred_url":"https://api.github.com/users/WrinklyNinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WrinklyNinja/subscriptions","organizations_url":"https://api.github.com/users/WrinklyNinja/orgs","repos_url":"https://api.github.com/users/WrinklyNinja/repos","events_url":"https://api.github.com/users/WrinklyNinja/events{/privacy}","received_events_url":"https://api.github.com/users/WrinklyNinja/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/WrinklyNinja/libloadorder/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-23T09:15:22Z","updated_at":"2015-11-23T11:36:04Z","closed_at":null,"body":"Plugin validity checks are pretty much the only expensive operation in libloadorder, as they involve reading the whole plugin file, which can be quite large and so reading can be slow. The performance of actual plugin reading is up to libespm, but there are a couple of things libloadorder can do to improve its performance:\r\n\r\n1. At the moment, validity is checked then the plugin is loaded, which involves two file reads (though the second only reads the file header). Given that libloadorder only deals with file headers, this could be combined into a single step, where a `Plugin` object is constructed, and if an exception is thrown then it is handled as an invalid plugin, and if not that constructed object is stored.\r\n2. When the load order is reloaded because filesystem changes have been detected, all data is discarded and re-loaded. Depending on the changes though, it could be that most or all of the existing plugin objects can be reused. Plugin modification times would need to be compared with their cached times to see if the objects need re-loading or not."},"comment":{"url":"https://api.github.com/repos/WrinklyNinja/libloadorder/issues/comments/158910854","html_url":"https://github.com/WrinklyNinja/libloadorder/issues/24#issuecomment-158910854","issue_url":"https://api.github.com/repos/WrinklyNinja/libloadorder/issues/24","id":158910854,"user":{"login":"Utumno","id":1365079,"avatar_url":"https://avatars.githubusercontent.com/u/1365079?v=3","gravatar_id":"","url":"https://api.github.com/users/Utumno","html_url":"https://github.com/Utumno","followers_url":"https://api.github.com/users/Utumno/followers","following_url":"https://api.github.com/users/Utumno/following{/other_user}","gists_url":"https://api.github.com/users/Utumno/gists{/gist_id}","starred_url":"https://api.github.com/users/Utumno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Utumno/subscriptions","organizations_url":"https://api.github.com/users/Utumno/orgs","repos_url":"https://api.github.com/users/Utumno/repos","events_url":"https://api.github.com/users/Utumno/events{/privacy}","received_events_url":"https://api.github.com/users/Utumno/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T11:36:04Z","updated_at":"2015-11-23T11:36:04Z","body":"> where a Plugin object is constructed, and if an exception is thrown then it is handled as an invalid plugin, and if not that constructed object is stored\r\n\r\nOf course that constructed object should be a few KBs big if not less\r\n\r\nGo for a static cache in the plugin class. I have commented on this somewhere - key should be modtime, size, name - value a slim Plugin instance - IIRC"}}