[issue] Very slow start time of azd Python extension binary on MacOS
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
**Summary:**
There is a significant performance difference when running the Python extension for azd on MacOS compared to inside a VS Code Dev Container on MacOS. The command to display the version takes ~6 seconds natively on MacOS but only ~0.6 seconds inside the Dev Container. The issue appears to be related to the darwin-arm64 build process for the Python extension, rather than a cold start issue. Symlinking a binary built with shiv to the expected location results in fast execution, supporting the hypothesis that the build process is the root cause.
**Reproduction Steps:**
1. Scaffold and build a Python extension for azd named `test` inside VS Code Dev Container on a MacOS host. The arch is `linux-arm64`
2. Run `azd test version` inside a VS Code Dev Container (MacOS host) and observe performance (~0.6s).
3. Clean and build the same test extension natively on MacOS host (the arch is `darwin-arm64`) and observe slow performance (~6s).
4. Symlink any native binary known to work fast to the extension location (`~/.azd/extensions/microsoft.azr/microsoft-azr-darwin-arm64`) and observe fast execution.
**Details and Observations:**
- The binary for MacOS is built as `darwin-arm64` but runs much slower than inside a Dev Container.
- Native compilation produces a valid Mach-O 64-bit arm64 binary but is slow nevertheless.
- Symlinking a binary built with shiv to the expected location results in fast execution, supporting the hypothesis that the build process is the root cause
**Logs**
Inside VS Code Dev Container on MacOS host
```
vscode ➜ /workspaces/azure-dev/tmp.test (main) $ time azd test version
Wallace.py extension version 0.0.1
Commit: b4bef437a6264bc1b43b7341870e8a8bea2e6ab4
Build date: 2025-09-11T04:25:07Z
real 0m0.616s
user 0m0.432s
sys 0m0.148s
```
Binary
```
vscode ➜ /workspaces/azure-dev/tmp.test (main) $ ll /home/vscode/.azd/extensions/tmp.test/
total 28212
drwxr-xr-x 2 vscode vscode 4096 Sep 11 04:24 ./
drwxr-xr-x 4 vscode vscode 4096 Sep 11 04:24 ../
-rw-r--r-- 1 vscode vscode 169 Sep 11 04:24 extension.yaml
-rwxr-xr-x 1 vscode vscode 28875480 Sep 11 04:25 tmp-test-linux-arm64*
```
On MacOS
```
(.venv)cv@cvidal-mbp-msft[±|azd-ext U:3 ✗]:~/.../tmp.test $ time azd test version
Wallace.py extension version 0.0.1
Commit: 59495b25ae8df8b02ab80cca7b97825e794ec287
Build date: 2025-09-11T02:26:13Z
real 0m6.480s
user 0m0.605s
sys 0m0.345s
```
Binary
```
cv@cvidal-mbp-msft:~ $ ll ~/.azd/extensions/tmp.test/
total 61576
drwxr-xr-x@ 4 cv staff 128 Sep 10 17:46 .
drwxr-xr-x@ 5 cv staff 160 Sep 10 17:46 ..
-rw-r--r--@ 1 cv staff 193 Sep 10 17:46 extension.yaml
-rwxr-xr-x@ 1 cv staff 30802192 Sep 10 19:27 tmp-test-darwin-arm64
cv@cvidal-mbp-msft:~ $
```
Contributor guide
Assessment
This issue has not been assessed yet.