Actually wanna talk about the history of this function since it's had a sorta interesting journey.https://twitter.com/Gankro/status/909484632294526977 …
But why can't the compiler just infer this? Why not just move the optimization into the front end of the compiler instead of growing libstd?
-
-
didn't have much of an optimization framework back then. does now, but would be a lot of work.
-
Yeah it relies on either an effect system or heavy inlining to determine there are no side effects, in general.
-
In this case, the inliner would just need to optimize empty statements as function bodies and maybe empty statements as loop bodies.
-
The cost of such recognition seems low and it's debugger-friendly since no *executable* code actually gets transformed in any way.
End of conversation
New conversation -
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.