Do I need to worry about binary size due to monomorphism in @rustlang? Will I accidentally blow up the size of the binary by using generics?
-
-
Ex: passing different closures into a big function should generate multiple copies of that function right? See: https://github.com/brain-lang/brainfuck/blob/master/src/bin/brainfuck.rs#L102-L120 …
1 reply 0 retweets 0 likes -
This is kind of a premature optimization question, but I'm really wondering about if the compiler ever doesn't
1 reply 0 retweets 0 likes -
...monomorphise everything in order to reduce the size of the binary
1 reply 0 retweets 0 likes -
Replying to @Sunjay03
If you use trait bounds, it's monomprphized. If you use trait objects, it's not.
1 reply 0 retweets 1 like -
Replying to @rustlang
Yes, that I understand, but will the compiler do anything special to optimize the binary size in cases with large generic functions?
2 replies 0 retweets 0 likes -
Also with trait objects it's important to note that it uses dynamic dispatch. Trading compile time cost (binary size) for a runtime cost
1 reply 0 retweets 0 likes
Yup, that's why it's not done automatically and you get to choose which you want
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.

