Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an array instead of a switch in token_kind_name #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RHL120
Copy link

@RHL120 RHL120 commented Feb 12, 2023

This change removes 19 lines of code and gives the function a (negligible) speed improvement .

@janw4ld
Copy link

janw4ld commented Feb 12, 2023

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

@RHL120
Copy link
Author

RHL120 commented Feb 12, 2023

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.
Thanks for the review!

@BillKek
Copy link
Contributor

BillKek commented Feb 12, 2023

Speed improvement makes by the compiler itself, IMHO. And UNREACHABLE feature lost.

@RHL120
Copy link
Author

RHL120 commented Feb 12, 2023

Speed improvement makes by the compiler itself, IMHO. And UNREACHABLE feature lost.

I can put it back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants