miri: Data race detector causes massive slowdown

Steps to reproduce:

Check out https://github.com/shepmaster/sxd-string-slab/commit/8bf847eff2a8a1609c818cae68d227156f5f3dc1, then run Miri:

time MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-disable-stacked-borrows -Zmiri-disable-data-race-detector' \
  CARGO_TARGET_DIR=target/miri \
  cargo miri test -- --nocapture
# Reports ~23 seconds on my machine

time MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-disable-data-race-detector' \
  CARGO_TARGET_DIR=target/miri \
  cargo miri test -- --nocapture
# Reports ~16.5 minutes on my machine

time MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-disable-stacked-borrows' \
  CARGO_TARGET_DIR=target/miri \
  cargo miri test -- --nocapture
# Reports ~4.25 minutes on my machine

Meta

  • macOS

  • rustc --version --verbose

    rustc 1.51.0-nightly (1d0d76f8d 2021-01-24)
    binary: rustc
    commit-hash: 1d0d76f8dd4f5f6ecbeab575b87edaf1c9f56bb8
    commit-date: 2021-01-24
    host: x86_64-apple-darwin
    release: 1.51.0-nightly
    LLVM version: 11.0.1
    
  • cargo miri --version --verbose

    miri 0.1.0 (1cf1a2e4 2021-01-15)
    

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

I will look into this properly later:

My guess would be that criterion is spawning a large set of threads for which the data-race detector is enabled for, potentially a large set with delayed synchronization - so from the perspective of the data-race detector there is a very large set of live concurrent threads to detect races for (probably crossing the smallvec threshold). I need to try track thread usage for a proper analysis.