dmarkham / enumer

A Go tool to auto generate methods for your enums
Other
410 stars 66 forks source link

Optimize IsAXXX method #74

Open bokunodev opened 1 year ago

bokunodev commented 1 year ago

we can optimize IsAXXX method to use switch statement instead of for loop. with this, we dont need stringBelongsMethodSet

dmarkham commented 9 months ago

I'm interested in a PR if you have an idea.

bokunodev commented 8 months ago

I believe, I've a prototype somewhere, unfortunately I'm currently nowhere near my computer.

manually unrolling the loop in the template and change it to switch case.I remember, i'm too lazy to fix the golden test. but I did test it and it actually perform wort with string enums also there is a proposal for loop unrolling on Go github account. so I'm not sure if it's worth to change anything, right now.