rust icon indicating copy to clipboard operation
rust copied to clipboard

Prevent running some code if it is already in the map

Open GuillaumeGomez opened this issue 1 year ago • 9 comments

I realized that a lot of duplicates were being run through this function. Might be better to prevent them from computing all the information if it's already in the cache.

r? @notriddle

GuillaumeGomez avatar Feb 02 '24 15:02 GuillaumeGomez

To be sure it will improve the performance:

@bors try @rust-timer queue

GuillaumeGomez avatar Feb 02 '24 15:02 GuillaumeGomez

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Feb 02 '24 15:02 rust-timer

:hourglass: Trying commit 256bbf9a6c2b2f7aa0a0538ecf82e0b0cd538856 with merge 00eab0249f70d1bfaec88d0d0ed6b05f40a1070e...

bors avatar Feb 02 '24 15:02 bors

:boom: Test timed out

bors avatar Feb 02 '24 19:02 bors

looks like CI is back! (EDIT: ah, how fun, wanted to be helpful and requeue all the timed out bors runs but...)

@bors retry

Teapot4195 avatar Feb 02 '24 19:02 Teapot4195

@Teapot4195: :key: Insufficient privileges: not in try users

bors avatar Feb 02 '24 19:02 bors

@bors try @rust-timer queue

notriddle avatar Feb 02 '24 19:02 notriddle

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Feb 02 '24 19:02 rust-timer

:hourglass: Trying commit 256bbf9a6c2b2f7aa0a0538ecf82e0b0cd538856 with merge ed34ce5fe0dd853ed089282835b8eeab88ea6ebb...

bors avatar Feb 02 '24 20:02 bors

:boom: Test timed out

bors avatar Feb 03 '24 00:02 bors

Hum maybe not completely back. ^^'

@bors try @rust-timer queue

GuillaumeGomez avatar Feb 03 '24 00:02 GuillaumeGomez

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Feb 03 '24 00:02 rust-timer

:hourglass: Trying commit 256bbf9a6c2b2f7aa0a0538ecf82e0b0cd538856 with merge 0a1f07c817940bbc7eb5c441564e484f1c323403...

bors avatar Feb 03 '24 00:02 bors

:boom: Test timed out

bors avatar Feb 03 '24 04:02 bors

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

rust-log-analyzer avatar Feb 03 '24 16:02 rust-log-analyzer

I rebased, maybe it'll change the odds in our favour? :pray:

@bors try @rust-timer queue

GuillaumeGomez avatar Feb 04 '24 22:02 GuillaumeGomez

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Feb 04 '24 22:02 rust-timer

:hourglass: Trying commit 0211221e9001314d54ece16e2634d51948f3ecb3 with merge 0158f5441d19716b360cd9628dde0045d676569f...

bors avatar Feb 04 '24 22:02 bors

:sunny: Try build successful - checks-actions Build commit: 0158f5441d19716b360cd9628dde0045d676569f (0158f5441d19716b360cd9628dde0045d676569f)

bors avatar Feb 04 '24 23:02 bors

Queued 0158f5441d19716b360cd9628dde0045d676569f with parent 4e3eed48926b8b70eee8beb082e37ffa4985c0ed, future comparison URL. There is currently 1 preceding artifact in the queue. It will probably take at least ~2.2 hours until the benchmark run finishes.

rust-timer avatar Feb 04 '24 23:02 rust-timer

Finished benchmarking commit (0158f5441d19716b360cd9628dde0045d676569f): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never @rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.8% [3.8%, 3.8%] 1
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
-2.2% [-6.1%, -0.6%] 19
Improvements ✅
(secondary)
-4.2% [-6.2%, -1.0%] 21
All ❌✅ (primary) -1.9% [-6.1%, 3.8%] 20

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.6% [2.2%, 3.0%] 2
Regressions ❌
(secondary)
2.9% [1.9%, 3.7%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.8%, -2.1%] 2
All ❌✅ (primary) 2.6% [2.2%, 3.0%] 2

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.5% [3.5%, 3.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-5.1%, -1.6%] 9
Improvements ✅
(secondary)
-4.1% [-5.1%, -2.0%] 17
All ❌✅ (primary) -2.0% [-5.1%, 3.5%] 10

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 661.383s -> 661.224s (-0.02%) Artifact size: 308.07 MiB -> 308.08 MiB (0.00%)

rust-timer avatar Feb 05 '24 01:02 rust-timer

Regressions aren’t in rustdoc, where this change was actually made.

@bors r+

notriddle avatar Feb 05 '24 02:02 notriddle

:pushpin: Commit 0211221e9001314d54ece16e2634d51948f3ecb3 has been approved by notriddle

It is now in the queue for this repository.

bors avatar Feb 05 '24 02:02 bors

:hourglass: Testing commit 0211221e9001314d54ece16e2634d51948f3ecb3 with merge f576e04b4cb9af47eef39e427dc0d4ee79604066...

bors avatar Feb 07 '24 09:02 bors

The job x86_64-apple-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[group][AOT] issue-72793
[AOT] issue-72793
error: linking with `cc` failed: exit status: 1
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/pipx_bin:/Users/runner/.cargo/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "x86_64" "-m64" "/var/folders/r0/ztvld9wd66bfpv_g6h3ksl000000gn/T/rustcp2xPfx/symbols.o" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example/issue-72793.issue_72793.fc0e4c056a5ff418-cgu.0.rcgu.o" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example/issue-72793.allocator_shim.rcgu.o" "-L" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example" "-L" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libstd-a7ffcf8feb5de0df.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libpanic_abort-f72dbe40e56cf4e9.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libobject-93683961e4fe014c.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-608f39623da2acc6.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-2b17e3e98a369b70.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libgimli-98e18d571f0d3c98.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-105905fe6fc6bf57.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-c72f1c866e7081dc.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-e82114027f985b88.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-f99fcd695211a1c9.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-9bba2c1110da01a8.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libadler-f86ef4dff75dd50c.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libunwind-0b11117ce25a1560.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-3fce4a1c07607df0.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/liblibc-e38fe75b4b440008.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/liballoc-2b3dd1868cffbb25.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-0171fe66a8ec9014.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libcore-939f78aa140a5d6b.rlib" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-83f97429b7f69221.rlib" "-lSystem" "-lc" "-lm" "-L" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example/issue-72793" "-Wl,-dead_strip" "-nodefaultlibs" "-Wl,-rpath,@loader_path/../lib" "-undefined" "dynamic_lookup"
  = note: ld: invalid r_symbolnum=14 in '/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example/issue-72793.issue_72793.fc0e4c056a5ff418-cgu.0.rcgu.o'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to 1 previous error


"/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/dist/rustc-clif" "--cap-lints=allow" "-Csymbol-mangling-version=v0" "-Zunstable-options" "--check-cfg=cfg(bootstrap)" "--check-cfg=cfg(parallel_compiler)" "-Zmacro-backtrace" "-Zosx-rpath-install-name" "-Clink-args=-Wl,-rpath,@loader_path/../lib" "-Csplit-debuginfo=unpacked" "--cfg=parallel_compiler" "-Clink-arg=-undefined" "-Clink-arg=dynamic_lookup" "-L" "crate=/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example" "--out-dir" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif/build/example" "-Cdebuginfo=2" "--target" "x86_64-apple-darwin" "-Cpanic=abort" "-Zunstable-options" "--check-cfg=cfg(no_unstable_features)" "--check-cfg=cfg(jit)" "example/issue-72793.rs" "--cfg" "no_unstable_features" exited with status ExitStatus(unix_wait_status(256))


command did not execute successfully: cd "/Users/runner/work/rust/rust/compiler/rustc_codegen_cranelift" && env -u MAKEFLAGS -u MFLAGS AR_x86_64_apple_darwin="ar" CARGO_BUILD_INCREMENTAL="false" CARGO_INCREMENTAL="0" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_PROFILE_RELEASE_STRIP="false" CARGO_TARGET_DIR="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-codegen" CC_x86_64_apple_darwin="sccache /Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang" CFG_COMPILER_BUILD_TRIPLE="x86_64-apple-darwin" CFG_COMPILER_HOST_TRIPLE="x86_64-apple-darwin" CFG_DEFAULT_CODEGEN_BACKEND="llvm" CFG_LIBDIR_RELATIVE="lib" CFG_RELEASE="1.78.0-nightly" CFG_RELEASE_CHANNEL="nightly" CFG_VERSION="1.78.0-nightly (f576e04b4 2024-02-07)" CFG_VER_DATE="2024-02-07" CFG_VER_HASH="f576e04b4cb9af47eef39e427dc0d4ee79604066" CFLAGS_x86_64_apple_darwin="-ffunction-sections -fdata-sections -fPIC --target=x86_64-apple-darwin" CXXFLAGS_x86_64_apple_darwin="-ffunction-sections -fdata-sections -fPIC --target=x86_64-apple-darwin -stdlib=libc++" CXX_x86_64_apple_darwin="sccache /Users/runner/work/rust/rust/clang+llvm-14.0.5-x86_64-apple-darwin/bin/clang++" LIBC_CHECK_CFG="1" LIBRARY_PATH="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/ci-llvm/lib" LLVM_CONFIG="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/ci-llvm/bin/llvm-config" LLVM_NDEBUG="1" LLVM_RUSTLLVM="1" RANLIB_x86_64_apple_darwin="ar s" REAL_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/native" RUSTC="/Users/runner/work/rust/rust/build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/Users/runner/work/rust/rust/build/tmp/extended-error-metadata" RUSTC_FORCE_UNSTABLE="1" RUSTC_HOST_FLAGS="-Zunstable-options --check-cfg=cfg(bootstrap)" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1/lib" RUSTC_LINT_FLAGS="-Wrust_2018_idioms -Wunused_lifetimes -Dwarnings" RUSTC_PRINT_STEP_TIMINGS="1" RUSTC_REAL="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1/bin/rustc" RUSTC_SNAPSHOT="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1/lib" RUSTC_STAGE="1" RUSTC_SYSROOT="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1" RUSTC_VERBOSE="0" RUSTC_VERIFY_LLVM_IR="1" RUSTC_WRAPPER="/Users/runner/work/rust/rust/build/bootstrap/debug/rustc" RUSTDOC="/Users/runner/work/rust/rust/build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="-Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(parallel_compiler) -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.78.0-nightly\t(f576e04b4\t2024-02-07) --cfg=parallel_compiler" RUSTDOC_LIBDIR="/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1/lib" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="-Csymbol-mangling-version=v0 -Zunstable-options --check-cfg=cfg(bootstrap) --check-cfg=cfg(parallel_compiler) -Zmacro-backtrace -Zosx-rpath-install-name -Clink-args=-Wl,-rpath,@loader_path/../lib -Csplit-debuginfo=unpacked --cfg=parallel_compiler" RUST_TEST_THREADS="4" TERM="xterm" WINAPI_NO_BUNDLED_LIBRARIES="1" __CARGO_DEFAULT_LIB_METADATA="nightlycodegen" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "run" "--target" "x86_64-apple-darwin" "--release" "-Zcheck-cfg" "-Zbinary-dep-depinfo" "-j" "4" "--locked" "--color" "always" "--manifest-path" "/Users/runner/work/rust/rust/compiler/rustc_codegen_cranelift/build_system/Cargo.toml" "--" "test" "--download-dir" "/Users/runner/work/rust/rust/build/cg_clif_download" "--out-dir" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-tools/cg_clif" "--no-unstable-features" "--use-backend" "cranelift" "--sysroot" "llvm" "--skip-test" "testsuite.extended_sysroot"

stdout ----

stderr ----

rust-log-analyzer avatar Feb 07 '24 10:02 rust-log-analyzer

:broken_heart: Test failed - checks-actions

bors avatar Feb 07 '24 10:02 bors

Seems flaky.

@bors retry

GuillaumeGomez avatar Feb 07 '24 10:02 GuillaumeGomez

:hourglass: Testing commit 0211221e9001314d54ece16e2634d51948f3ecb3 with merge 81bef0b0ba78f9b7bb08beb0575e245fbe18674a...

bors avatar Feb 08 '24 07:02 bors

:sunny: Test successful - checks-actions Approved by: notriddle Pushing 81bef0b0ba78f9b7bb08beb0575e245fbe18674a to master...

bors avatar Feb 08 '24 10:02 bors

Finished benchmarking commit (81bef0b0ba78f9b7bb08beb0575e245fbe18674a): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-5.9%, -0.8%] 19
Improvements ✅
(secondary)
-4.0% [-6.4%, -0.6%] 22
All ❌✅ (primary) -2.3% [-5.9%, -0.8%] 19

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.2% [2.2%, 2.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-2.7%, -2.7%] 1
All ❌✅ (primary) 2.2% [2.2%, 2.2%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-3.9%, -1.3%] 8
Improvements ✅
(secondary)
-3.5% [-4.2%, -1.6%] 15
All ❌✅ (primary) -2.2% [-3.9%, -1.3%] 8

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 662.662s -> 664.584s (0.29%) Artifact size: 308.26 MiB -> 308.26 MiB (0.00%)

rust-timer avatar Feb 08 '24 12:02 rust-timer