diff --git a/scripts/import_profiler/documentation.md b/scripts/import_profiler/documentation.md new file mode 100644 index 000000000000..a93323847673 --- /dev/null +++ b/scripts/import_profiler/documentation.md @@ -0,0 +1,72 @@ +# Python SDK Import Profiler: Documentation & Breakdown + +This document provides a comprehensive guide to the `import_profiler` scripts, directory files, and how to analyze the generated import trace logs to target optimization areas. + +--- + +## 1. File Guide & Directory Structure +The profiling tool is located in the [scripts/import_profiler/](./) directory: + +* **[profiler.py](./profiler.py)**: The core executable script. It is designed as a single-file, self-spawning harness that performs process-isolated importing benchmarks and generates trace logs. + +--- + +## 2. Profiler Mechanism (`profiler.py`) + +**Objective** +The Profiler functions as a process-isolated verification harness designed to capture before-and-after metrics across three distinct vectors: Initialization Latency (ms), Peak Memory Usage (MB), and Dynamic Code Volume (Loaded Modules & Lines of Code). + +**Usage** + +Run this command to collect the metrics: +```bash +python profiler.py --module --iterations +``` + +**Expected Output** +```text +--- Results for ( iterations) --- +Code Volume (Deterministic): + Loaded Modules: + Loaded Lines: +Time (ms): + P50 (Median):