-
Notifications
You must be signed in to change notification settings - Fork 49
Replace OnceLock
+ fn
with LazyLock
#256
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
Conversation
DECOMPOSED_AMOUNTS.get_or_init(|| { | ||
[ | ||
/// Decomposed amount table. | ||
pub static DECOMPOSED_AMOUNTS: LazyLock<[u64; 172]> = LazyLock::new(|| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the LazyLock
here, keep it a static though. I don't know why I made this a OnceLock
, the data is still in the binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must say I'm confused on why this isn't a const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
is a ref to 1 memory address containing the data, const
inlines the data everywhere it gets used.
I assume @Boog900 doesn't want it inlined in the binary everywhere it gets used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confused, I thought const weren't inlined. Thanks for the heads-up
What
Closes #236.
This replaces the
OnceLock
+fn
s that were used in aLazyLock
type of way for the entire codebase. There's otherOnceLock
s remaining but they are used differently.