{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11174","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11174/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11174/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11174/events","html_url":"https://github.com/JuliaLang/julia/issues/11174","id":73727427,"number":11174,"title":"Range comparisons don't generate optimal code in some cases","user":{"login":"ScottPJones","id":11798751,"avatar_url":"https://avatars.githubusercontent.com/u/11798751?v=3","gravatar_id":"","url":"https://api.github.com/users/ScottPJones","html_url":"https://github.com/ScottPJones","followers_url":"https://api.github.com/users/ScottPJones/followers","following_url":"https://api.github.com/users/ScottPJones/following{/other_user}","gists_url":"https://api.github.com/users/ScottPJones/gists{/gist_id}","starred_url":"https://api.github.com/users/ScottPJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScottPJones/subscriptions","organizations_url":"https://api.github.com/users/ScottPJones/orgs","repos_url":"https://api.github.com/users/ScottPJones/repos","events_url":"https://api.github.com/users/ScottPJones/events{/privacy}","received_events_url":"https://api.github.com/users/ScottPJones/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/performance","name":"performance","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-06T20:27:05Z","updated_at":"2015-05-06T21:22:22Z","closed_at":null,"body":"A common C trick to see if something is within a range is to subtract the base of the range, and use an unsigned comparison.\r\nJulia has the nice syntax where you can say something like `0xd000 <= ch <= 0xdffff`, however,\r\nthat generates branches, instead of a simple subtraction and single comparison.\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/99613494","html_url":"https://github.com/JuliaLang/julia/issues/11174#issuecomment-99613494","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11174","id":99613494,"user":{"login":"ScottPJones","id":11798751,"avatar_url":"https://avatars.githubusercontent.com/u/11798751?v=3","gravatar_id":"","url":"https://api.github.com/users/ScottPJones","html_url":"https://github.com/ScottPJones","followers_url":"https://api.github.com/users/ScottPJones/followers","following_url":"https://api.github.com/users/ScottPJones/following{/other_user}","gists_url":"https://api.github.com/users/ScottPJones/gists{/gist_id}","starred_url":"https://api.github.com/users/ScottPJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScottPJones/subscriptions","organizations_url":"https://api.github.com/users/ScottPJones/orgs","repos_url":"https://api.github.com/users/ScottPJones/repos","events_url":"https://api.github.com/users/ScottPJones/events{/privacy}","received_events_url":"https://api.github.com/users/ScottPJones/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T21:22:22Z","updated_at":"2015-05-06T21:22:22Z","body":"For Unicode, it may even be (as long as you're not in Japan!) that branch if ch < 0xd800 first, and *then* doing the trick to see if it's in the range 0xe000 to 0x10ffff, might be the fastest for most input...\r\nIt seems though that I still need to use my old C tricks for best performance (esp.  where I know in advance something about the input data)..."}}