{"action":"created","issue":{"url":"https://api.github.com/repos/MycroftAI/mimic/issues/77","repository_url":"https://api.github.com/repos/MycroftAI/mimic","labels_url":"https://api.github.com/repos/MycroftAI/mimic/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/MycroftAI/mimic/issues/77/comments","events_url":"https://api.github.com/repos/MycroftAI/mimic/issues/77/events","html_url":"https://github.com/MycroftAI/mimic/issues/77","id":171231257,"number":77,"title":"Optimize voice loading","user":{"login":"forslund","id":804543,"avatar_url":"https://avatars.githubusercontent.com/u/804543?v=3","gravatar_id":"","url":"https://api.github.com/users/forslund","html_url":"https://github.com/forslund","followers_url":"https://api.github.com/users/forslund/followers","following_url":"https://api.github.com/users/forslund/following{/other_user}","gists_url":"https://api.github.com/users/forslund/gists{/gist_id}","starred_url":"https://api.github.com/users/forslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forslund/subscriptions","organizations_url":"https://api.github.com/users/forslund/orgs","repos_url":"https://api.github.com/users/forslund/repos","events_url":"https://api.github.com/users/forslund/events{/privacy}","received_events_url":"https://api.github.com/users/forslund/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-15T18:31:33Z","updated_at":"2016-08-15T23:50:37Z","closed_at":null,"body":"To reduce startup time the voice loading should be optimized.\r\n\r\nPossibilities\r\n- Reduce number of calls to `cst_fread()`\r\n- Increase read buffer using `setvbuf()`\r\n- Restructure flitevox-file to allow for more efficient reading\r\n- inline commonly used functions (?)"},"comment":{"url":"https://api.github.com/repos/MycroftAI/mimic/issues/comments/239963561","html_url":"https://github.com/MycroftAI/mimic/issues/77#issuecomment-239963561","issue_url":"https://api.github.com/repos/MycroftAI/mimic/issues/77","id":239963561,"user":{"login":"zeehio","id":75441,"avatar_url":"https://avatars.githubusercontent.com/u/75441?v=3","gravatar_id":"","url":"https://api.github.com/users/zeehio","html_url":"https://github.com/zeehio","followers_url":"https://api.github.com/users/zeehio/followers","following_url":"https://api.github.com/users/zeehio/following{/other_user}","gists_url":"https://api.github.com/users/zeehio/gists{/gist_id}","starred_url":"https://api.github.com/users/zeehio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeehio/subscriptions","organizations_url":"https://api.github.com/users/zeehio/orgs","repos_url":"https://api.github.com/users/zeehio/repos","events_url":"https://api.github.com/users/zeehio/events{/privacy}","received_events_url":"https://api.github.com/users/zeehio/received_events","type":"User","site_admin":false},"created_at":"2016-08-15T23:50:37Z","updated_at":"2016-08-15T23:50:37Z","body":"I will write what I would do, but feel free to take the approach you prefer: \r\n\r\nIn order to optimize only what needs to be optimized, I would write a simple unittest-like program that loads the  Mycroft voice from a file and prints the time it takes to load it. Then I would run it several times to get an estimate of the performance on my computer.\r\nThen I would try those optimizations from easier to harder. \r\n\r\n- inline functions seems easy but if the compiler is smart enough it should do it automatically so I don't expect a huge gain there. I don't know how smart compilers are, so I may be wrong here.\r\n- I have never used setvbuf but if it is easy to setup it should reduce many internal read calls. It may be good.\r\n- Reducing the number of cst_fread calls is possible up to a limit due to how the file format is set up. Strings are of variable length so I don't know how much can that be optimized.\r\n\r\nI believe the slowness is due to either:\r\n\r\n- too many small reads from file (would be solved by setvbuf)\r\n- too many small cst_alloc calls when creating the cart trees. The solution for this would be to have a big malloc and put several tree nodes all together in there somehow...\r\n- too many function calls in general. If that is the case we will need to think of a better format for dumping/loading cart trees...\r\n\r\nHope I can be of help!"}}
{"actor":{"display_login":"zeehio"}}