https://pantsbuild.org/ logo
h

hundreds-breakfast-49010

03/19/2020, 2:23 AM
thinking aloud, I wonder if
pants_loader
and
pants_exe
need to be separate files
if we were going to replace the first chunk of pants initialization code with a rust program, I would think that
pants_loader
,
pants_exe
, and possibly
pants_runner
are what it would replace
👍 1
w

witty-crayon-22786

03/19/2020, 2:33 AM
the loader is used to load either the daemon or pants itself, iirc.
because two entrypoints.
but possibly.
h

hundreds-breakfast-49010

03/19/2020, 2:34 AM
I'm also wondering if the
pants
binary itslef needs to be a shell script
w

witty-crayon-22786

03/19/2020, 2:35 AM
would want to figure out how the binary is distributed before thinking about that, probably.
h

hundreds-breakfast-49010

03/19/2020, 2:36 AM
anyway @witty-crayon-22786 it's hard to run py-spy on pants because
pants
is a shells script. although I guess I could just modify it to include
py-spy
in what it invokes
w

witty-crayon-22786

03/19/2020, 2:36 AM
The pid
See the example command I pasted
h

hundreds-breakfast-49010

03/19/2020, 2:38 AM
I don't think that helps me profile the very beginning of a pants run, before pantsd is running
w

witty-crayon-22786

03/19/2020, 2:39 AM
true. but that's not the portion that is relevant in the context of "how fast is pantsd"
would recommend something like
Copy code
sudo echo
sudo py-spy record -p $pantsdpid --output x.svg & ./pants $goaltotest kill-pantsd
basically, warm up
sudo
then spawn py-spy in parallel with starting the goal you want to test
then kill-pantsd, which will cause the py-spy recording to complete
h

hundreds-breakfast-49010

03/19/2020, 2:41 AM
why sudo?
w

witty-crayon-22786

03/19/2020, 2:41 AM
because py-spy (used to?) require it
h

hundreds-breakfast-49010

03/19/2020, 2:42 AM
in this case I think I do want to profile what's happening before pants talks to a running pantsd instance
👍 1
if that's where 1-2 sec of latency is
👍 1
anyway it looks like I can do this by replacing a line in the
pants
shell script
and it doesn't seem to require sudo
w

witty-crayon-22786

03/19/2020, 2:43 AM
if that's where 1-2 sec of latency is
sure. but we already know how to fix that part.
h

hundreds-breakfast-49010

03/19/2020, 2:44 AM
that's the stuff you said pierre knows about, right?
or had thought about?
w

witty-crayon-22786

03/19/2020, 2:44 AM
the whole client should be replaced with a rust or c binary
👍 1
h

hundreds-breakfast-49010

03/19/2020, 2:44 AM
I think that's actually teh thing that toolchain cares about right now
👍 1
it's what I expect to be working on for the next while, anyway
❤️ 1
w

witty-crayon-22786

03/19/2020, 2:44 AM
yea, it's big. as mentioned earlier in here, the server portion is more unknown.
h

hundreds-breakfast-49010

03/19/2020, 2:45 AM
so I want to make sure that I can see that replacing that bit of code with rust is actually a win
I believe there's latency that can be fixed in the server too, but I think for now we'd be happy if connecting to a warm pantsd was quick
❤️ 1
and the fix for that will also make every pants run, pantsd or no, 1-2 sec quicker
w

witty-crayon-22786

03/19/2020, 2:46 AM
Screen Shot 2020-03-18 at 7.46.06 PM.png
@hundreds-breakfast-49010: you don't need to profile to see that the client is bad. can just look at the server log
and see that it takes 1.5-2 seconds between starting a command and the first logging in the server
(
.pants.d/pantsd/pantsd.log
)