Hi, I’m trying to use pants for a dummy hello worl...
# development
Hi, I’m trying to use pants for a dummy hello world target: BUILD:
Copy code

pex_binary(entry_point="main.py", name="bin")
Copy code
print("Hello world")
However running it takes ~2 seconds:
Copy code
./pants run bins:bin  0.59s user 0.15s system 37% cpu 1.984 total
Am I doing something wrong or should I expect a big penalty from pex binaries?
hm with the user number at 0.59s and system at 0.15s, I'm confused why total is so high at 1.984 2s is probably higher than we'd anticipate, especially for a small repo. Although also a cold run will be slower than a warm run, thanks to caching and the Pants daemon. What's the benchmark for running it a second time?
I’m running on macOS:
Copy code
$ time ./pants --version

real	0m0.832s
user	0m0.549s
sys	0m0.125s
Just running
gets a hit of 600-900ms
👍 1
I’m getting similar numbers on a linux machine
Ah yes, indeed. That is being actively worked on with https://github.com/pantsbuild/pants/issues/11831. @enough-analyst-54434 found about ~500ms saved with the proof of concept. That landed in pantsbuld/pants, but isn't yet stable for wider consumption The maintainers are planning this week what our next priorities are (in large part thanks to feedback from the community survey you might have seen!), and I think this will probably come up in prioritizing. Right now, supporting lockfiles (https://github.com/pantsbuild/pants/issues/12314) pushed it back a little. cc @witty-crayon-22786
@melodic-thailand-99227: until that is fixed, you can run
pants package
to build the binary, and then run the binary independently
PEX has a variety of execution modes, but the
mode should be ~as fast as a venv.
Concretely, set https://www.pantsbuild.org/docs/reference-pex_binary#codeexecution_modecode to either
. As explained there,
will get you the fastest subsequent runs after an initial run