← Back to context

Comment by ameliaquining

2 days ago

Yeah, I think of avoiding the call from main as a devex consideration rather than a performance one, since either way the initialization code runs once at process startup.

But it can cause problems when there's multiple crates trying to do it. If the call is explicit, the application developer can sequence the calls appropriately (or at least deterministically), as opposed to having the order determined by details of the implementation (something that was learned from the C++ 'static initialization order fiasco')

I'm trying to think of any useful crate that really uses this. "Tracy", the profiling crate, used to self-start on loading, but that was changed to require a call to get it going.