bazel-ios / rules_ios

Bazel rules for building iOS applications and frameworks
Apache License 2.0
270 stars 84 forks source link

[xcodeproj] LLDB search paths O(N XcodeRuns) growth #287

Open jerrymarino opened 2 years ago

jerrymarino commented 2 years ago

I noticed the LLDB search paths have an O(N XcodeRuns) growth rate. In other words, the growth rate is proportional to the number of times I run the app. The 2 pieces of evidence are in the settings, and I noticed LLDB performing several stat operations on a signle file at an increasing rate.

This was within a rules_ios project, however I'm not sure it's related to rules_ios. Tested on

Xcode 12.1
Build version 12A7403
debug-file-search-paths (file-list) =
  [0]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [1]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [2]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [3]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [4]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [5]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [6]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator
target.default-arch (arch) = 
target.detach-on-error (boolean) = true
target.disable-aslr (boolean) = true
target.disable-stdio (boolean) = false
target.x86-disassembly-flavor (enum) = default
target.display-expression-in-crashlogs (boolean) = false
target.display-recognized-arguments (boolean) = false
target.display-runtime-support-values (boolean) = false
target.enable-synthetic-value (boolean) = true
env-vars (dictionary of strings) =
target.error-path (file) = 
exec-search-paths (file-list) =
  [0]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [1]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [2]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [3]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [4]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [5]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [6]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator  [7]: /Users/jmarino/Library/Developer/Xcode/DerivedData/bazel-project-hjacvhupxduqpdamhfgrlcfihgcv/Build/Products/Debug-iphonesimulator/
thiagohmcruz commented 2 years ago

Worth trying on a non-bazel project and compare the settings? Also were you using one of the test apps in the repo or is this an internal app? Looking for a way to repro myself.

thiagohmcruz commented 2 years ago

Also is this with the VFS stuff on? Looking at the description makes me think if it could be related to bad in-memory state

jerrymarino commented 2 years ago

@thiagohmcruz this was VFS on and off on an internal app. I'd be interested to see if the debugger slows down in certain conditions after doing several builds and runs.

Perhaps we can build an performance suite on the C++ or pyhton API. The LLDB integration test https://github.com/llvm/llvm-project/blob/b87e6c6a2ba97a8b5c876298e4bf74a775f6ee30/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py may be of help here to integrate this into the performance suite.