rust-lang-deprecated / error-chain

Error boilerplate for Rust
Apache License 2.0
729 stars 111 forks source link

env::var_os("RUST_BACKTRACE") should only be called once. #207

Closed eddyb closed 7 years ago

eddyb commented 7 years ago

The caching can be done with just an AtomicBool (thanks, @edef1c!). I'm seeing something like a hundred thousand allocations from this, per second, and C calls, of course, and none of those are really needed (they might be small but they're profiling noise).

Yamakaky commented 7 years ago

I don't think it's checked in this crate?

eddyb commented 7 years ago

It's in lib.rs last I looked (make_backtrace).

Yamakaky commented 7 years ago

Right! Do you want to try a PR?

eddyb commented 7 years ago

@Yamakaky Ended up doing it, see #210.

Arnavion commented 7 years ago

This can be closed now, right?

eddyb commented 7 years ago

Right, thanks for the reminder!