( )⚙ D4346 hg: wrap the highest layer in the `hg` script possible in trace event

This is an archive of the discontinued Mercurial Phabricator instance.

hg: wrap the highest layer in the `hg` script possible in trace event
ClosedPublic

Authored by durin42 on Aug 21 2018, 5:39 PM.

Details

Summary

This should help us have a better idea of what "interpreter startup
costs" look like. This does omit the HGUNICODEPEDANTRY block and the
LIBDIR dancing to set up sys.path, but the former is usually off and
the latter is unavoidable and should be very fast. If we get worried
about those cases we can consider open-coding the tracing logic here.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

durin42 created this revision.Aug 21 2018, 5:39 PM
indygreg added inline comments.
hg
14–21

I think we want to defer the import until after reload(sys). Keep in mind that importing the sub-module will import the parent one. And the parent one contains code that is somewhat important.

But we still want to measure time spent here. This may warrant a one-off hack to record a session ID and raw times here and to feed that into the tracer manually after we've done this extremely early setup.

indygreg requested changes to this revision.Aug 24 2018, 1:12 PM
indygreg added inline comments.
hg
23–30

Attempting to import hgdemandimport before this block is wrong, since we may fail to find the hgdemandimport package.

I think we'll want to record trace events / times in this file explicitly and then generate trace events for them only once the environment is set up.

Truth be told, I don't expect much time to be spent between lines 12 and 28 of the current file. So I'm not sure it is worth going through this trouble. Although I would love to be proved wrong!

This revision now requires changes to proceed.Aug 24 2018, 1:12 PM
durin42 edited the summary of this revision. (Show Details)Aug 28 2018, 1:59 PM
durin42 updated this revision to Diff 10620.

I think this is ready? Do I owe you anything else on it?

This revision was automatically updated to reflect the committed changes.