Skip to content

py_binary launch performance problem on windows #2019

Open
@peakschris

Description

@peakschris

On windows, with rules_python as module and system interpreter and a simple script:

> timecmd bazel run //:myscript -- --help
command took 5.6s

> timecmd python myscript.py --help
command took 0.5s

Due to the 10x overhead, for such a regularly run tool, users are refusing to run via bazel. I'm guessing the overhead is unzipping, but am not sure. We would prefer to run without zipping if zipping has a 10x overhead.

Full output from bazel run:

INFO: Analyzed target //:myscript (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:myscript up-to-date:
  bazel-bin/myscript.zip
  bazel-bin/myscript.exe
INFO: Elapsed time: 0.494s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/myscript.exe --help
Usage: <snip>
command took 5.6s

Relevant options:

.bazelrc

startup --windows_enable_symlinks
common --noenable_runfiles
common --nolegacy_external_runfiles

Module.bazel

bazel_dep(name = "rules_python", version = "0.32.2")
# use system python for performance
register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain")

🐞 bug report

Affected Rule

py_binary

Is this a regression?

No

🔬 Minimal Reproduction

I can create this if it would help

🌍 Your Environment

Operating System:

  
Windows
  

Output of bazel version:

  
bazel 7.2.1
  

Rules_python version:

  
0.32.2
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions