{"action":"created","issue":{"url":"https://api.github.com/repos/munificent/wren/issues/110","labels_url":"https://api.github.com/repos/munificent/wren/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/munificent/wren/issues/110/comments","events_url":"https://api.github.com/repos/munificent/wren/issues/110/events","html_url":"https://github.com/munificent/wren/issues/110","id":54312383,"number":110,"title":"Performance optimisation of readName method","user":{"login":"Calamari","id":149719,"avatar_url":"https://avatars.githubusercontent.com/u/149719?v=3","gravatar_id":"","url":"https://api.github.com/users/Calamari","html_url":"https://github.com/Calamari","followers_url":"https://api.github.com/users/Calamari/followers","following_url":"https://api.github.com/users/Calamari/following{/other_user}","gists_url":"https://api.github.com/users/Calamari/gists{/gist_id}","starred_url":"https://api.github.com/users/Calamari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Calamari/subscriptions","organizations_url":"https://api.github.com/users/Calamari/orgs","repos_url":"https://api.github.com/users/Calamari/repos","events_url":"https://api.github.com/users/Calamari/events{/privacy}","received_events_url":"https://api.github.com/users/Calamari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-14T11:35:48Z","updated_at":"2015-01-14T13:24:26Z","closed_at":null,"body":"Hi.\r\n\r\nI just started to also read a bit of what is happening under the hood of wren and started with the compiler. It looks really straight forward. Kind of what I write when writing simple compilers. While reading, I stumbled upon line 529ff and thought that it could be done faster, right?\r\n\r\nMy C knowledge is a bit rusty (did that in school a bit, but that's really long ago), but the `readName` method seems to be doing much more then it has to. If you would read a `break token, you would still call the ìsKeyword`-method 15 times more often then you would have, when bailing out after matching the `break` if statement. Maybe something like:\r\n\r\n```c\r\nif (isKeyword(parser, \"break\")) type = TOKEN_BREAK;\r\nelse if (isKeyword(parser, \"class\")) type = TOKEN_CLASS;\r\nelse if (isKeyword(parser, \"else\")) type = TOKEN_ELSE;\r\n…\r\n```\r\n\r\nOr using a switch statement or something?\r\n"},"comment":{"url":"https://api.github.com/repos/munificent/wren/issues/comments/69915053","html_url":"https://github.com/munificent/wren/issues/110#issuecomment-69915053","issue_url":"https://api.github.com/repos/munificent/wren/issues/110","id":69915053,"user":{"login":"minirop","id":451828,"avatar_url":"https://avatars.githubusercontent.com/u/451828?v=3","gravatar_id":"","url":"https://api.github.com/users/minirop","html_url":"https://github.com/minirop","followers_url":"https://api.github.com/users/minirop/followers","following_url":"https://api.github.com/users/minirop/following{/other_user}","gists_url":"https://api.github.com/users/minirop/gists{/gist_id}","starred_url":"https://api.github.com/users/minirop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minirop/subscriptions","organizations_url":"https://api.github.com/users/minirop/orgs","repos_url":"https://api.github.com/users/minirop/repos","events_url":"https://api.github.com/users/minirop/events{/privacy}","received_events_url":"https://api.github.com/users/minirop/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T13:24:25Z","updated_at":"2015-01-14T13:24:25Z","body":"switch statement isn't possible since you can only check 1 value against several integers.\r\nBut I also do think that \"else\" should be added."}}