Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx 3.3 is roughly 3.2x slower than sphinx 3.2.1 #8372

Closed
sgugger opened this issue Nov 4, 2020 · 1 comment
Closed

Sphinx 3.3 is roughly 3.2x slower than sphinx 3.2.1 #8372

sgugger opened this issue Nov 4, 2020 · 1 comment

Comments

@sgugger
Copy link

sgugger commented Nov 4, 2020

Describe the bug

We recently noticed the doc builds for the 🤗 Transformers library were a lot slower with the recent release. We pinned the version to 3.2.1 for now and it solved the issue, but we wanted to let you know about the slowdown.

To Reproduce
Steps to reproduce the behavior:

$ git clone https://github.com/huggingface/transformers/
$ cd transformers
$ pip install --upgrade pip
$ pip install .[tf,torch,sentencepiece,docs]
$ cd docs
$ make html SPHINXOPTS="-W"

With sphinx 3.3.0, the build takes 5min21s on a CircleCI Docker Medium (the size doesn't really impact execution time), whereas sphinx 3.2.1 completes the build in 1min40s (on the same machine). Most of the slowdown is coming in the "[reading sources]" part of the build.

Expected behavior
I'd expect the change of version to not impact the time of the build in such a way.

Your project
Link to your sphinx project, or attach zipped small project sample.

Environment info

  • OS: Linux
  • Python version: 3.7.9
  • Sphinx version: 3.2.1/3.3.0
  • Sphinx extensions:
    • 'sphinx.ext.autodoc',
    • 'sphinx.ext.coverage',
    • 'sphinx.ext.napoleon',
    • 'recommonmark',
    • 'sphinx.ext.viewcode',
    • 'sphinx_markdown_tables',
    • 'sphinx_copybutton'
@tk0miya
Copy link
Member

tk0miya commented Nov 5, 2020

Note: reproduce the slowdown with following Dockerfile:

FROM python:3.8-slim

RUN apt update; apt install -y build-essential curl git unzip vim
RUN git clone https://github.com/huggingface/transformers/
WORKDIR /transformers
RUN pip install --upgrade pip
RUN pip install ".[tf,torch,sentencepiece,docs]"
RUN pip install Sphinx==3.3.0
WORKDIR /transformers/docs
RUN make html SPHINXOPTS=-vW

@tk0miya tk0miya added this to the 3.3.1 milestone Nov 5, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 8, 2020
…Sphinx-3.2

* The result of ModuleAnalyzer.parse() is not cached
* autodoc tries to search overloaded constructor methods to the root
  class even if a definition found
tk0miya added a commit to tk0miya/sphinx that referenced this issue Nov 8, 2020
…Sphinx-3.2

* The result of ModuleAnalyzer.parse() is not cached
* autodoc tries to search overloaded constructor methods to the root
  class even if a definition found
tk0miya added a commit that referenced this issue Nov 9, 2020
Fix #8372: autodoc: autoclass directive became slower than Sphinx-3.2
@tk0miya tk0miya closed this as completed Nov 9, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants