{"action":"created","issue":{"url":"https://api.github.com/repos/DaveDavenport/rofi/issues/241","labels_url":"https://api.github.com/repos/DaveDavenport/rofi/issues/241/labels{/name}","comments_url":"https://api.github.com/repos/DaveDavenport/rofi/issues/241/comments","events_url":"https://api.github.com/repos/DaveDavenport/rofi/issues/241/events","html_url":"https://github.com/DaveDavenport/rofi/pull/241","id":109281094,"number":241,"title":"Fast ascii filtering","user":{"login":"larkery","id":1721963,"avatar_url":"https://avatars.githubusercontent.com/u/1721963?v=3","gravatar_id":"","url":"https://api.github.com/users/larkery","html_url":"https://github.com/larkery","followers_url":"https://api.github.com/users/larkery/followers","following_url":"https://api.github.com/users/larkery/following{/other_user}","gists_url":"https://api.github.com/users/larkery/gists{/gist_id}","starred_url":"https://api.github.com/users/larkery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larkery/subscriptions","organizations_url":"https://api.github.com/users/larkery/orgs","repos_url":"https://api.github.com/users/larkery/repos","events_url":"https://api.github.com/users/larkery/events{/privacy}","received_events_url":"https://api.github.com/users/larkery/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-01T11:28:35Z","updated_at":"2015-10-01T12:49:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/DaveDavenport/rofi/pulls/241","html_url":"https://github.com/DaveDavenport/rofi/pull/241","diff_url":"https://github.com/DaveDavenport/rofi/pull/241.diff","patch_url":"https://github.com/DaveDavenport/rofi/pull/241.patch"},"body":"I've done something again around the collation speed thing. Changes are:\r\n\r\n - in `menu()`, every input string is scanned for non-ascii codepoints.\r\n - this is to populate an array `lines_not_ascii` in `MenuState`\r\n - matching functions are supplied with an extra `not_ascii` parameter to tell them whether a particular line of input needs collating and case-folding or not\r\n\r\nI haven't made it work in flex yet, because the flex rule will need rewriting a little (there is no strcasechr in the standard library to use in case-insensitive ascii mode).\r\n\r\nCompared to the pre-collation approach I did before this:\r\n - doesn't store an extra copy of the input in memory; instead we have 1 int extra per input\r\n - doesn't add any noticeable startup time (the scan for non-ascii lines takes about a microsecond for half a million lines)\r\n\r\nWhen most of the input is ascii it reduces the filtering time by about a thousandfold.\r\n\r\nI've also very marginally improved the dmenu read speed by reducing the number of strlens and mallocs it does a little, so that you get to the menu slightly quicker."},"comment":{"url":"https://api.github.com/repos/DaveDavenport/rofi/issues/comments/144717556","html_url":"https://github.com/DaveDavenport/rofi/pull/241#issuecomment-144717556","issue_url":"https://api.github.com/repos/DaveDavenport/rofi/issues/241","id":144717556,"user":{"login":"larkery","id":1721963,"avatar_url":"https://avatars.githubusercontent.com/u/1721963?v=3","gravatar_id":"","url":"https://api.github.com/users/larkery","html_url":"https://github.com/larkery","followers_url":"https://api.github.com/users/larkery/followers","following_url":"https://api.github.com/users/larkery/following{/other_user}","gists_url":"https://api.github.com/users/larkery/gists{/gist_id}","starred_url":"https://api.github.com/users/larkery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larkery/subscriptions","organizations_url":"https://api.github.com/users/larkery/orgs","repos_url":"https://api.github.com/users/larkery/repos","events_url":"https://api.github.com/users/larkery/events{/privacy}","received_events_url":"https://api.github.com/users/larkery/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T12:49:43Z","updated_at":"2015-10-01T12:49:43Z","body":"I've fixed the fuzzy part as well - this now fuzzes correctly for unicode chars which it didn't before (it would match some pathological situations where a wide character with a couple of bytes like `b1 b2` is the token and the input line is some other wide characters like `b1 b3` ... `b4 b2`."}}