-
Notifications
You must be signed in to change notification settings - Fork 180
Description
What does #[strum(use_phf)] do on a #[derive(strum::EnumString)] enum? The only documentation is:
/// If you have a large enum, you may want to consider using the `use_phf` attribute here. It leverages
/// perfect hash functions to parse much quicker than a standard `match`. (MSRV 1.46)
That's it. What does this do? What does it mean, for those of us without a PhD in computer science? It generates a hash per variant for the string representation or something? Which string does it use, the #[strum(to_string = "...")] one? I'm just guessing here, no idea, and #220 refers to #218 which refers to the phf crate. At this point, I have given up, there are too many rabbit holes to figure out what this does, how it works, what code it generates, how it impacts my performance / memory usage, etc.
Someone took hours to implement this feature. Would be worth 10 minutes to write up a paragraph describing what it does, and when and how to use it.
Thank you.