-
Notifications
You must be signed in to change notification settings - Fork 29
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
Furo: investigate slow builds #328
Comments
Some more rough Furo build times:
Autosummary is definitely a big problem, and the HTML pages aren't even being built since disabling all other extensions broke them, so the time taken to populate |
I'm pretty sure this is because of Furo's warning in pradyunsg/furo#227 (comment)
Unlike Pytorch, Furo puts every single subpage in the left ToC. This hypothesis is consistent with Helena's research above -- autosummary results in substantially more subpages being created. I think we have two options:
|
I'm definitely in favor of trimming the ToC to reduce page size. As for the dedicated pages, there definitely are a lot of function and attribute pages that are basically stubs and not worth being rendered on their own page. But I'm wondering if this might lead to complex and well-documented classes/modules generating very long pages. |
@coruscating found some great data: #451 (comment). The Pytorch theme is now building 5x slower on 1.13 than 1.12! I'm going to |
While we still need to figure out #328, this release candidate fixes several issues discovered in 1.13.0rc1, especially with responsiveness (mobile).
Do you have an example documentation set for me to look at, that produces these slow behaviours? |
Thanks @pradyunsg for offering to take a look! Check out https://github.com/Qiskit/qiskit-metapackage/suites/13985744654/artifacts/780412210. You'll notice the file size bloats to about 700-900kb and the build takes 3.5 hours vs. 30 minutes for Pytorch, with around 85-90% of the HTML being the left side bar. Again, we know we need to fix this by not having dedicated HTML pages per function & tutorial. But even still, we will have a huge amount of docs because the Qiskit API is so large. |
Yea, the most of that toctree is basically your autosummary documentation. I think the first thing I'd try to do is use https://pypi.org/project/sphinx-remove-toctrees/ with: remove_from_toctrees = ["stubs/*"] That should handle the toctree problem that you have. FWIW, it would be useful to have the sources and instructions to building documentation with those sources -- I'm interested in profiling where in Furo's own codebase is the hot-loop/ slowness. |
100%. I believe the time complexity is O(n^2): for every n page, we rerun One angle I haven't explored enough yet is if it
Good idea to benchmark removing all stubs. We only removed methods, which took us from 3.5 hours to 1.5 hours. See Qiskit/qiskit-metapackage#1770. Although,
Ah, pardon. It's this repo: https://github.com/Qiskit/qiskit-metapackage and this PR: Qiskit/qiskit-metapackage#1767. We use some custom directives so it won't work to directly use Then, It is likely much faster and less frustrating to artificially generate a test site. Afaict, the important thing is # of HTML pages, not the content on those pages. Qiskit has this 4527 pages:
Also, we do a weird thing of Git cloning two other repos for the docs build, diff --git a/docs/conf.py b/docs/conf.py
index a16a69b..56959f7 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -251,7 +251,7 @@ def trim_toctree(_: sphinx.application.Sphinx, env) -> None:
def setup(app):
custom_extensions.load_terra_docs(app)
- custom_extensions.load_tutorials(app)
+ # custom_extensions.load_tutorials(app)
versionutils.setup(app)
app.connect("build-finished", custom_extensions.clean_docs)
app.connect("env-updated", trim_toctree)
diff --git a/docs/index.rst b/docs/index.rst
index 7a4392f..9c13dbc 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -64,7 +64,6 @@ Main Qiskit-related projects
qc_intro
getting_started
intro_tutorial1
- tutorials
API Reference <apidoc/terra>
Migration Guides <migration_guides/index>
release_notes
diff --git a/docs/tutorials.rst b/docs/tutorials.rst
deleted file mode 100644
index 40d6361..0000000
--- a/docs/tutorials.rst
+++ /dev/null
@@ -1,69 +0,0 @@
-:orphan:
-
-.. _tutorials:
-
-=========
-Tutorials
-=========
-
-Introductory
-============
-
-.. qiskit-card::
- :header: Qiskit warmup
- :card_description: An introduction to Qiskit and the primary user workflow.
- :image: _static/images/logo.png
- :link: intro_tutorial1.html
-
-Quantum circuits
-================
-
-.. nbgallery::
- :glob:
-
- tutorials/circuits/*
-
-Advanced circuits
-=================
-
-.. nbgallery::
- :glob:
-
- tutorials/circuits_advanced/*
-
-Classical simulators
-====================
-
-.. nbgallery::
- :glob:
-
- tutorials/simulators/*
-
-Algorithms
-==========
-
-.. nbgallery::
- :glob:
-
- tutorials/algorithms/*
-
-Operators
-=========
-
-.. nbgallery::
- :glob:
-
- tutorials/operators/*
-
-Sample algorithms in Qiskit
-===========================
-
-.. nbgallery::
- :glob:
-
- tutorials/textbook/*
-
-.. Hiding - Indices and tables
- :ref:`genindex`
- :ref:`modindex`
- :ref:`search`
|
Ugh, yea, that makes sense. :/ |
@pradyunsg good news! Your suggestion of using So, maybe you'd be open to something like this?
That is, #674 is solely intended as a tool for dev builds, not prod builds. Additionally, maybe it's possible to optimize Thoughts?
If you're not comfortable merging #674, then I think we'll use
We'd love to make it easier to help other Furo users facing similar build speed issues. |
@pradyunsg Is it possible to introduce the option of rendering the sidebar as a separate asset? It would solve a lot of problems for us if the sidebar can be cached user-side. Here's some toy code for
And then |
### Summary This PR switches the docs to the new Furo ecosystem theme. ![image](https://github.com/Qiskit-Extensions/qiskit-experiments/assets/3870315/e93ee925-805e-466a-991a-fd30b663a24f) ### Details and comments New build variables have been added: - `FULL_TOCTREE` builds the full API toctree when turned on. By default, this is off for a fast build time and small file sizes. This is turned on for deployments. See Qiskit/qiskit_sphinx_theme#328 for more info. - `VERSION_STRING` and `RELEASE_STRING` are exposed so that the site can display an alternative version/release for builds. This is relevant for the dev site, where we would like to see the `git describe` commit string instead of the version to be clearer to users. The new theme currently does not expose the version/release (except for the release in the page title) since it doesn't have breadcrumbs, but this will be added after Qiskit/qiskit_sphinx_theme#361. ### Current known issues: The experiment gallery doesn't render correctly: ![image](https://github.com/Qiskit-Extensions/qiskit-experiments/assets/3870315/13bd6dfc-8732-4337-9e9b-67ce709f7409)
To close the loop, we were able to get acceptable speeds by
Interestingly, viewcode results in a 14 minute slowdown for Qiskit when using Furo! I think it was only about a 30 second slowdown when using the old Pytorch theme. |
I'd be open to that, as an opt-in option. I'm wary of the complexity of this solution somewhat -- but we can investigate that separately perhaps. |
I timed the Qiskit Experiments sphinx build after an identical previous build has already run and without running any jupyter-sphinx code, so the only tasks should be checking that there are no updates to the code and writing output pages. It's ~70 seconds with the current theme, but ~1700 seconds with the Furo build. The main bottleneck is in the writing output and highlighting module code phases.
The text was updated successfully, but these errors were encountered: