I have a library that really needs optimizations turned on to run efficiently. Hence, in CI I always run cargo test --release. I noticed that a doc test takes over a minute to run when the same test completes in under a second when run outside of a doc example.
However, doc tests always seem to run in debug mode as confirmed by this playground snippet. If you run the tests in debug mode, the non-doc test will panic. However, if you run in release mode, the same test put in a doc comment will panic while the non-doc test passes. Is this expected?