Profiling build time for each page

30 views
Skip to first unread message

Thomas Robitaille

unread,
Nov 12, 2019, 12:16:49 PM11/12/19
to sphinx-users
Hi all,

I'm building a very large set of documentation using sphinx, and I'd like to be able to easily identify pages that are contributing the most to the build time. Is there any built-in way or any sphinx extension that can be used to easily profile a build in this way and find out how long each page is taking to build?

Thanks!
Tom

Komiya Takeshi

unread,
Nov 16, 2019, 6:37:28 AM11/16/19
to sphinx...@googlegroups.com
Hi Tom,

Unfortunately, AFAIK there are no such feature and extensions. In
addition, Sphinx goes documentation build step by step. Read all
documents, transform them all, convert and write them all... So it is
difficult to measure build time per document.

FWIW, as a quick hack, you can see reading and writing time per
document with adding code to your `conf.py`:
```
import logging
from sphinx.util.logging import ColorizeFormatter

logger = logging.getLogger('sphinx')
for handler in logger.handlers:
handler.setFormatter(ColorizeFormatter('%(asctime)-15s %(message)s'))
```
It might be good to give `-v` option to sphinx-build command.

Thanks,
Takeshi KOMIYA

2019年11月13日(水) 2:16 Thomas Robitaille <thomas.r...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/893e07b3-77a7-4421-97b9-1ca4b1a1bacc%40googlegroups.com.

Thomas Robitaille

unread,
Nov 22, 2019, 1:02:49 PM11/22/19
to sphinx...@googlegroups.com
Hi Takeshi,

This is very helpful and works great, thanks!

Cheers,
Tom
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAFmkQAMT3H6eRtsLdxeDiwy5Ksc-85ZSmRdCEetCRsNQhaf-jg%40mail.gmail.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages