Use an array instead of a switch in token_kind_name#63
Use an array instead of a switch in token_kind_name#63RHL120 wants to merge 1 commit intotsoding:masterfrom
Conversation
|
this removes the concrete link between each Token_kind value and the name that represents it, which makes the code less readable and less extensible. the data structure that would be an improvement is a map, but that's pretty overkill |
Yeah I guess there is a trade off here, I would chose the array method but the maintainer might disagree with me. |
|
Speed improvement makes by the compiler itself, IMHO. And |
I can put it back. |
This change removes 19 lines of code and gives the function a (negligible) speed improvement .