BCad fork

Distribution Size Analysis
Login

Distribution Size Analysis

Current state: 604 MB (--onedir mode).

Breakdown by category

Category Size Notes
OCC .pyd (SWIG wrappers) 288 MB 291 files; bcad uses ~45 modules
OCCT DLLs (libTK*.dll) 64 MB All stripped (no debug symbols)
scipy + scipy.libs 67 MB One function: scipy.spatial.ConvexHull
OCC .py + .pyi 28 MB .pyi = type hints, not needed at runtime
numpy + numpy.libs 27 MB Used by scipy + bcad directly
imgui_bundle + DLLs 24 MB +3 MB duplicate MinGW DLLs in subdir
PIL (Pillow) 11 MB
libmamba.dll 17 MB Conda solver, not needed at runtime
Tcl/Tk 7 MB bcad does not use tkinter
Other (bcad, fonts, assets, etc.) ~31 MB

Top 10 largest files

File Size
numpy.libs/libscipy_openblas64_*.dll 20 MB
scipy.libs/libscipy_openblas*.dll 20 MB
libmamba.dll 17 MB
libTKDESTEP.dll 8.1 MB
libcrypto-3-x64.dll 7.1 MB
python314.dll 6.9 MB
libTKGeomBase.dll 5.1 MB
libTKGeomAlgo.dll 5.1 MB
libTKBool.dll 4.1 MB
libTKDEIGES.dll 3.9 MB

Optimization opportunities

Post Windows-port-launch only.

1. Filter OCC modules (~200 MB) — ✅ PARTIALLY DONE

bcad uses ~45 direct modules (AIS, BRep*, gp, TopoDS, V3d, Graphic3d, etc.), which expand to 161 total transitively.

Where to change for Windows: packaging/cross-build-wine.sh (PyInstaller invocation), packaging/build-wine/bcad-windows.spec, packaging/build-wine/bcad.spec.

2. Remove scipy (~67 MB) — ✅ DONE

Replaced scipy.spatial.ConvexHull with C++ QuickHull implementation (cpp/bcad_hull/). scipy is no longer imported or bundled. Saved ~67 MB.

3. Disable unused imgui_bundle components — ❌ NOT DONE

bcad uses 3 components: imgui (core), imgui_color_text_edit, portable_file_dialogs. Everything else is unused.

Currently only MICROTEX=OFF and IMMVISION=OFF are set. The following could be added to the cmake invocation:

-DIMGUI_BUNDLE_WITH_HELLO_IMGUI=OFF   # cascades: disables immapp, imgui_md, test_engine
-DIMGUI_BUNDLE_WITH_IMPLOT=OFF
-DIMGUI_BUNDLE_WITH_IMPLOT3D=OFF
-DIMGUI_BUNDLE_WITH_IMGUI_NODE_EDITOR=OFF
-DIMGUI_BUNDLE_WITH_IMGUIZMO=OFF
-DIMGUI_BUNDLE_WITH_NANOVG=OFF
-DIMGUI_BUNDLE_WITH_IMANIM=OFF
-DIMGUI_BUNDLE_WITH_IMGUI_EXPLORER_LIB=OFF

Risk: HELLO_IMGUI=OFF switches to standalone imgui build path. Need to verify imgui.backends.glfw_init_for_opengl (GLFW+OpenGL3 backend) is still available in standalone mode — bcad manages its own GLFW window, does not use hello_imgui.run().

Where to change: packaging/cross-build-wine.sh (cmake flags at line ~353), cpp/imgui_bundle/CMakePresets.json.

4. Remove libmamba.dll (17 MB) — ➖ N/A

Not present in current build. libmamba was a Conda solver dependency; the build pipeline no longer uses Conda for the final Python runtime.

5. Remove Tcl/Tk (7 MB) — ❌ NOT DONE

bcad does not use tkinter. Exclude via --exclude-module _tkinter in PyInstaller.

Currently _tkinter.pyd, tcl86t.dll, tk86t.dll are present in the distribution.

Where to change: packaging/cross-build-wine.sh (PyInstaller invocation), packaging/build-wine/bcad-windows.spec (excludes list).

6. Remove .pyi stubs (5 MB) — ❌ NOT DONE

Type hints (*.pyi in OCC/Core/) not needed at runtime. Post-build deletion: find _internal/OCC -name '*.pyi' -delete

Currently 323 .pyi files (5.3 MB) present in distribution.

Where to change: packaging/cross-build-wine.sh (add cleanup step after PyInstaller).

7. Deduplicate MinGW DLLs (3 MB) — ❌ NOT DONE

libstdc++-6.dll, libgcc_s_seh-1.dll, libwinpthread-1.dll exist both in _internal/ and _internal/imgui_bundle/. Remove from imgui_bundle/ subdir post-build.

Where to change: packaging/cross-build-wine.sh (add post-build cleanup).

Potential savings summary

Measure Savings Status
Filter OCC modules ~200 MB ❌ NOT DONE
Remove scipy ~67 MB ✅ DONE
Disable unused imgui_bundle components TBD (needs testing) ❌ NOT DONE
Remove libmamba.dll ~17 MB ➖ N/A
Remove Tcl/Tk ~7 MB ❌ NOT DONE
Remove .pyi stubs ~5 MB ❌ NOT DONE
Deduplicate MinGW DLLs ~3 MB ❌ NOT DONE
Total (remaining) ~215 MB