Private
Public Access
0
0
Files
manual_slop/docs/reports/startup_baseline_20260606.txt
ed 6f9a3af201 feat(audit): add main-thread import graph audit + baseline measurements
Phase 1, Tasks T1.2 + T1.4 of the startup_speedup_20260606 track.

NEW: scripts/audit_main_thread_imports.py
  Static CI gate that AST-walks the import graph reachable from
  sloppy.py and fails (exit 1) if any heavy module is imported at the
  top of a main-thread-reachable file. Walks into if/elif/else and
  try/except branches (which run at import time) but skips function
  bodies (which only run when called). Allowlist: stdlib + the lean
  gui_2 skeleton (imgui_bundle, defer, src.imgui_scopes, src.theme_2,
  src.theme_models, src.paths, src.models, src.events).

NEW: scripts/audit_gui2_imports.py
  Read-only analysis tool that lists every top-level and function-level
  import in src/gui_2.py, classified by location. Used in Phase 5D to
  identify which imports to remove.

NEW: tests/test_audit_main_thread_imports.py
  9 tests covering: --help exits 0, clean stdlib-only passes, heavy
  third-party fails, google.genai fails, transitive walks, function-
  body imports ignored, if-branch imports flagged, try-block imports
  flagged, file:line reported. All 9 pass.

NEW: docs/reports/startup_baseline_20260606.txt
  3-run median cold-start benchmark. Worst offenders: src.gui_2
  (1770ms), simulation.user_agent (1517ms), google.genai (1001ms),
  openai (482ms), anthropic (441ms), imgui_bundle (255ms),
  src.theme_nerv* (485ms combined), src.markdown_table (243ms),
  src.command_palette (242ms).

NEW: docs/reports/startup_audit_20260606.txt
  Audit output on the CURRENT codebase. Reports 67 violations across
  the main-thread import graph (incl. numpy in src/gui_2.py:9,
  tomli_w in src/gui_2.py:18, fastapi + requests in src/app_controller,
  tree_sitter_* in src/file_cache, pydantic in src/models, plus all
  the src.* subsystem imports that drag in heavy transitive deps).
  Phase 3-5 of the track will resolve these one by one.

After Phase 3-5, this audit must exit 0 (no violations).

Co-located reports in docs/reports/ per project convention; the other
agent finished their work in docs/superpowers/ and is unrelated.
2026-06-06 14:22:18 -04:00

203 lines
15 KiB
Plaintext

scanning imports in: ./src, ./simulation
project root: C:\projects\manual_slop
sys.path: ['C:\\projects\\manual_slop', 'C:\\projects\\manual_slop\\thirdparty']
found 84 unique importable module paths. benchmarking (3 runs each, timeout 30s)...
[ 1/84] anthropic 441.41ms (1 files) ok
[ 2/84] api_hook_client FAIL (4 files) ModuleNotFoundError: No module named 'api_hook_client'
[ 3/84] ast 7.11ms (4 files) ok
[ 4/84] asyncio 55.76ms (6 files) ok
[ 5/84] atexit 0.03ms (1 files) ok
[ 6/84] collections 2.50ms (2 files) ok
[ 7/84] contextlib 4.50ms (2 files) ok
[ 8/84] copy 3.20ms (4 files) ok
[ 9/84] dataclasses 17.07ms (12 files) ok
[ 10/84] datetime 1.72ms (8 files) ok
[ 11/84] difflib 8.46ms (3 files) ok
[ 12/84] fastapi 234.13ms (1 files) ok
[ 13/84] fastapi.security.api_key 229.52ms (1 files) ok
[ 14/84] glob 9.20ms (1 files) ok
[ 15/84] google 0.75ms (1 files) ok
[ 16/84] google.genai 1001.89ms (1 files) ok
[ 17/84] hashlib 2.87ms (3 files) ok
[ 18/84] html.parser 10.92ms (1 files) ok
[ 19/84] http.server 41.37ms (1 files) ok
[ 20/84] imgui_bundle 255.59ms (10 files) ok
[ 21/84] importlib 1.23ms (1 files) ok
[ 22/84] inspect 15.34ms (1 files) ok
[ 23/84] json 9.59ms (15 files) ok
[ 24/84] logging 15.98ms (1 files) ok
[ 25/84] math 0.04ms (3 files) ok
[ 26/84] numpy 68.41ms (2 files) ok
[ 27/84] openai 482.69ms (1 files) ok
[ 28/84] os 0.00ms (22 files) ok
[ 29/84] pathlib 11.99ms (29 files) ok
[ 30/84] psutil 24.25ms (1 files) ok
[ 31/84] pydantic 75.38ms (1 files) ok
[ 32/84] queue 6.65ms (1 files) ok
[ 33/84] random 2.26ms (2 files) ok
[ 34/84] re 7.43ms (13 files) ok
[ 35/84] requests 99.20ms (3 files) ok
[ 36/84] scripts 0.55ms (1 files) ok
[ 37/84] shutil 12.08ms (4 files) ok
[ 38/84] simulation.sim_base FAIL (6 files) ModuleNotFoundError: No module named 'api_hook_client'
[ 39/84] simulation.sim_tools FAIL (1 files) ModuleNotFoundError: No module named 'api_hook_client'
[ 40/84] simulation.user_agent 1517.24ms (2 files) ok
[ 41/84] simulation.workflow_sim FAIL (2 files) ModuleNotFoundError: No module named 'api_hook_client'
[ 42/84] src 0.51ms (21 files) ok
[ 43/84] src.command_palette 241.69ms (1 files) ok
[ 44/84] src.context_presets 140.86ms (1 files) ok
[ 45/84] src.dag_engine 157.86ms (2 files) ok
[ 46/84] src.diff_viewer 29.88ms (1 files) ok
[ 47/84] src.events 19.29ms (1 files) ok
[ 48/84] src.file_cache 32.48ms (4 files) ok
[ 49/84] src.fuzzy_anchor 14.83ms (1 files) ok
[ 50/84] src.gemini_cli_adapter 28.34ms (1 files) ok
[ 51/84] src.gui_2 1770.78ms (2 files) ok
[ 52/84] src.hot_reloader 20.99ms (2 files) ok
[ 53/84] src.log_registry 16.27ms (1 files) ok
[ 54/84] src.markdown_table 242.54ms (1 files) ok
[ 55/84] src.models 135.85ms (16 files) ok
[ 56/84] src.paths 19.11ms (5 files) ok
[ 57/84] src.performance_monitor 27.04ms (2 files) ok
[ 58/84] src.personas 137.78ms (1 files) ok
[ 59/84] src.summary_cache 19.18ms (1 files) ok
[ 60/84] src.theme_models 29.19ms (1 files) ok
[ 61/84] src.theme_nerv 246.46ms (1 files) ok
[ 62/84] src.theme_nerv_fx 254.55ms (1 files) ok
[ 63/84] src.tool_bias 146.49ms (1 files) ok
[ 64/84] src.tool_presets 142.35ms (1 files) ok
[ 65/84] subprocess 12.02ms (6 files) ok
[ 66/84] sys 0.00ms (17 files) ok
[ 67/84] tempfile 14.94ms (1 files) ok
[ 68/84] threading 4.62ms (7 files) ok
[ 69/84] time 0.00ms (20 files) ok
[ 70/84] tkinter 17.60ms (1 files) ok
[ 71/84] tomli_w 5.62ms (9 files) ok
[ 72/84] tomllib 14.81ms (11 files) ok
[ 73/84] traceback 11.06ms (5 files) ok
[ 74/84] tree_sitter 11.70ms (1 files) ok
[ 75/84] tree_sitter_c 23.70ms (1 files) ok
[ 76/84] tree_sitter_cpp 24.13ms (1 files) ok
[ 77/84] tree_sitter_python 23.76ms (1 files) ok
[ 78/84] typing 10.12ms (48 files) ok
[ 79/84] urllib.parse 9.78ms (1 files) ok
[ 80/84] urllib.request 39.22ms (1 files) ok
[ 81/84] uuid 6.00ms (2 files) ok
[ 82/84] webbrowser 17.23ms (2 files) ok
[ 83/84] websockets 43.12ms (1 files) ok
[ 84/84] websockets.asyncio.server 83.24ms (1 files) ok
==============================================================================================================
import time rankings (cold start, sorted slowest first)
thresholds: red > 200ms yellow > 50ms green <= 50ms
stats: median=17.4ms p90=246.5ms n=80 ok, 4 failed benchmark wall=44.5s
==============================================================================================================
module time files rank status
-----------------------------------------------------------------------------------------------
src.gui_2 1770.78ms 2 1 ok
simulation.user_agent 1517.24ms 2 2 ok
google.genai 1001.89ms 1 3 ok
openai 482.69ms 1 4 ok
anthropic 441.41ms 1 5 ok
imgui_bundle 255.59ms 10 6 ok
src.theme_nerv_fx 254.55ms 1 7 ok
src.theme_nerv 246.46ms 1 8 ok
src.markdown_table 242.54ms 1 9 ok
src.command_palette 241.69ms 1 10 ok
fastapi 234.13ms 1 11 ok
fastapi.security.api_key 229.52ms 1 12 ok
src.dag_engine 157.86ms 2 13 ok
src.tool_bias 146.49ms 1 14 ok
src.tool_presets 142.35ms 1 15 ok
src.context_presets 140.86ms 1 16 ok
src.personas 137.78ms 1 17 ok
src.models 135.85ms 16 18 ok
requests 99.20ms 3 19 ok
websockets.asyncio.server 83.24ms 1 20 ok
pydantic 75.38ms 1 21 ok
numpy 68.41ms 2 22 ok
asyncio 55.76ms 6 23 ok
websockets 43.12ms 1 24 ok
http.server 41.37ms 1 25 ok
urllib.request 39.22ms 1 26 ok
src.file_cache 32.48ms 4 27 ok
src.diff_viewer 29.88ms 1 28 ok
src.theme_models 29.19ms 1 29 ok
src.gemini_cli_adapter 28.34ms 1 30 ok
src.performance_monitor 27.04ms 2 31 ok
psutil 24.25ms 1 32 ok
tree_sitter_cpp 24.13ms 1 33 ok
tree_sitter_python 23.76ms 1 34 ok
tree_sitter_c 23.70ms 1 35 ok
src.hot_reloader 20.99ms 2 36 ok
src.events 19.29ms 1 37 ok
src.summary_cache 19.18ms 1 38 ok
src.paths 19.11ms 5 39 ok
tkinter 17.60ms 1 40 ok
webbrowser 17.23ms 2 41 ok
dataclasses 17.07ms 12 42 ok
src.log_registry 16.27ms 1 43 ok
logging 15.98ms 1 44 ok
inspect 15.34ms 1 45 ok
tempfile 14.94ms 1 46 ok
src.fuzzy_anchor 14.83ms 1 47 ok
tomllib 14.81ms 11 48 ok
shutil 12.08ms 4 49 ok
subprocess 12.02ms 6 50 ok
pathlib 11.99ms 29 51 ok
tree_sitter 11.70ms 1 52 ok
traceback 11.06ms 5 53 ok
html.parser 10.92ms 1 54 ok
typing 10.12ms 48 55 ok
urllib.parse 9.78ms 1 56 ok
json 9.59ms 15 57 ok
glob 9.20ms 1 58 ok
difflib 8.46ms 3 59 ok
re 7.43ms 13 60 ok
ast 7.11ms 4 61 ok
queue 6.65ms 1 62 ok
uuid 6.00ms 2 63 ok
tomli_w 5.62ms 9 64 ok
threading 4.62ms 7 65 ok
contextlib 4.50ms 2 66 ok
copy 3.20ms 4 67 ok
hashlib 2.87ms 3 68 ok
collections 2.50ms 2 69 ok
random 2.26ms 2 70 ok
datetime 1.72ms 8 71 ok
importlib 1.23ms 1 72 ok
google 0.75ms 1 73 ok
scripts 0.55ms 1 74 ok
src 0.51ms 21 75 ok
math 0.04ms 3 76 ok
atexit 0.03ms 1 77 ok
sys 0.00ms 17 78 ok
os 0.00ms 22 79 ok
time 0.00ms 20 80 ok
api_hook_client -- 4 81 ModuleNotFoundError: No module named 'api_hook_client'
simulation.sim_base -- 6 82 ModuleNotFoundError: No module named 'api_hook_client'
simulation.sim_tools -- 1 83 ModuleNotFoundError: No module named 'api_hook_client'
simulation.workflow_sim -- 2 84 ModuleNotFoundError: No module named 'api_hook_client'
top 10 candidates for lazy / deferred loading (>= 200ms):
-> src.gui_2 1770.78ms
-> simulation.user_agent 1517.24ms
-> google.genai 1001.89ms
-> openai 482.69ms
-> anthropic 441.41ms
-> imgui_bundle 255.59ms
-> src.theme_nerv_fx 254.55ms
-> src.theme_nerv 246.46ms
-> src.markdown_table 242.54ms
-> src.command_palette 241.69ms
failed imports (4):
api_hook_client ModuleNotFoundError: No module named 'api_hook_client'
simulation.sim_base ModuleNotFoundError: No module named 'api_hook_client'
simulation.sim_tools ModuleNotFoundError: No module named 'api_hook_client'
simulation.workflow_sim ModuleNotFoundError: No module named 'api_hook_client'