this post was submitted on 11 Aug 2023
14 points (100.0% liked)

Rust

5949 readers
6 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] TehPers@beehaw.org 3 points 1 year ago

This could be really neat for optimized builds. If using a PHF produces more efficient code for Debug representations, then even at the expense of compile times (only in optimized builds) it might be a big win for libraries using huge error enums.

I wonder if this can be extrapolated even further for error enums that have nested errors in it (with no dynamic fields except the nested error enums), using a PHF to map all the potentially hundreds of variant/subvariant combinations to unique strings, of course assuming this results in a performance win. I'm sure there are even more places where it could be useful to use a PHF too.