Improve |mach doc| performance
Categories
(Developer Infrastructure :: Source Documentation, enhancement)
Tracking
(Not tracked)
People
(Reporter: ahal, Assigned: Sylvestre)
References
(Blocks 1 open bug)
Details
(Keywords: leave-open)
Attachments
(5 files, 2 obsolete files)
I think there might be some low-hanging fruit to improve the |mach doc| performance (which is generally really terrible). A couple ideas: 1. Upgrade sphinx to latest version 2. Use sphinx's -J argument (not sure how much of an impact this has) 3. Build regular and python API docs in parallel (these are two separate sphinx invocations on unrelated directories that happen serially) 4. Be smarter about caching results and only re-building what we need to. Sphinx normally does this automatically, but since we move the entire doctree from the srcdir->objdir each time, it thinks everything has always changed. This might be better off in a follow-up.
Reporter | ||
Comment 1•6 years ago
|
||
Another idea: Make a sphinx build backend so we don't need to re-read moz.build each time. Rebuilds triggered via the livereload server already cache this result however, so it might not be as worthwhile.
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Hi Andrew,
For 1, I guess the sphinx is already the latest version i.e. 1.8.5 as installed using pipenv
For 2, Can you please link me to the argument you are referring.
For 3, I was thinking of using ThreadPoolExecutor in light of ProcessPool. Am I wandering right?
Reporter | ||
Comment 3•5 years ago
|
||
Hi Anurag, sorry I missed your comment.
This bug is currently earmarked for a GSoC internship (he may be about to start working on it shortly). But since there are multiple things to work on here, maybe we could split it out into smaller bugs and divide things up in a way that won't cause you to step on each other's toes. So just hang on for now if you're still interested and I'll let you know.
Comment 4•5 years ago
|
||
No problem and yes I am still interested. Please let me know, if you have anything I can work on. :D
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Updated•5 years ago
|
Comment 6•5 years ago
|
||
Depends on D41058
Updated•5 years ago
|
Comment 7•5 years ago
|
||
:ahal , can you please review D41062.
:championshuttler, I removed the "checkin-needed". Please add it after the patch is r+ .
Comment 8•5 years ago
|
||
Narcis, thanks. It will be reviewed soon. Clearing ni for :ahal.
Reporter | ||
Updated•5 years ago
|
Pushed by ahalberstadt@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/07e30c57a8e6 Improve mach doc performance, use sphinx's -J argument. r=ahal
Comment 10•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 11•4 years ago
|
||
- Upgrade sphinx to latest version
Moving from 1.8.5 => 2.2.2 isn't improving much the time.
./mach doc --no-serve 125,26s user 10,34s system 158% cpu 1:25,70 total
=>
./mach doc --no-serve 122,69s user 8,54s system 184% cpu 1:11,11 total
Bug 1601612 for the implementation
Comment 12•4 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:rstewart, maybe it's time to close this bug?
Updated•4 years ago
|
Assignee | ||
Comment 13•4 years ago
|
||
Actually, we will work on that.
emil, gsoc student, might have some time to have a look.
Assignee | ||
Comment 14•4 years ago
|
||
Assignee | ||
Comment 15•4 years ago
|
||
Assignee | ||
Comment 16•4 years ago
|
||
To generate this:
diff --git a/mach b/mach
--- a/mach
+++ b/mach
@@ -65,17 +65,17 @@ py2commands="
run_py() {
# Try to run a specific Python interpreter. Fall back to the system
# default Python if the specific interpreter couldn't be found.
py_executable="$1"
shift
if which "$py_executable" > /dev/null
then
- exec "$py_executable" "$0" "$@"
+ exec "$py_executable" -m cProfile -s ncalls "$0" "$@"
elif [ "$py_executable" = "python2.7" ]; then
exec python "$0" "$@"
else
echo "This mach command requires $py_executable, which wasn't found on the system!"
exit 1
fi
}
And run with
./mach -v doc --no-serve &> foo2.log
Assignee | ||
Comment 17•4 years ago
|
||
To generate better infos:
use:
exec "$py_executable" -m cProfile -o machdoc.cprof -s ncalls "$0" "$@"
in mach doc
then
pyprof2calltree -k -i machdoc.cprof
More on my buddy website:
https://julien.danjou.info/guide-to-python-profiling-cprofile-concrete-case-carbonara/
Comment 18•3 years ago
|
||
Is there still something that needs to be fixed on this bug that i could lay my hands on?
Reporter | ||
Comment 19•3 years ago
|
||
Perhaps you could fix some of the warnings that show up with ./mach doc
(ideally there shouldn't be any warnings). There aren't any bugs on file, but you can file one once you've picked a few warnings to tackle.
Assignee | ||
Comment 20•3 years ago
•
|
||
It is getting worse and worse!
I run the python profiler. It seems that, for a normal doc build, we are calling 981 869 277 times a function called "sentry_patched_popen_communicate".
So, disabling sentry (export DISABLE_TELEMETRY=1) dropped the time from
./mach doc --no-serve &> foo.log 383,58s user 141,69s system 64% cpu 13:37,21 total
to
./mach doc --no-serve &> foo.log 136,96s user 7,55s system 144% cpu 1:40,21 total
Assignee | ||
Comment 21•3 years ago
|
||
Updated•3 years ago
|
Assignee | ||
Comment 22•3 years ago
|
||
Depends on D123795
Assignee | ||
Updated•3 years ago
|
Comment 23•3 years ago
|
||
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/925cdf01fd85 doc: Disable sentry as it adds significant overhead r=mhentges https://hg.mozilla.org/integration/autoland/rev/775e23b5bf52 doc: ride along bump sentry r=mhentges
Comment 24•3 years ago
|
||
bugherder |
Comment 25•2 years ago
|
||
The leave-open keyword is there and there is no activity for 6 months.
:Sylvestre, maybe it's time to close this bug?
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 26•2 years ago
|
||
Yeah, still slow... but I don't have a better solution for now
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 27•1 year ago
•
|
||
to profile it:
python3 -m cProfile -o machdoc.cprof -s ncalls mach doc
python3 -m snakeviz machdoc.cprof
or
pyprof2calltree -k -i machdoc.cprof
Comment 29•1 year ago
|
||
Depends on D173680
Comment 30•1 year ago
|
||
Comment on attachment 9325204 [details]
Bug 1460678 - upgrade sphinx to version 5 r=#firefox-source-docs-reviewers
Revision D173704 was moved to bug 1824659. Setting attachment 9325204 [details] to obsolete.
Description
•