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

Improve memory consumption: del page.markdown #2677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FrancoisCapon
Copy link
Contributor

Hi,

This pull request follow the discussion on the #2669 issue and improve only the "First phase" because in this case theory and graph match: more 1 MB earned

The graph show the full memory consumption of mkdocs because I put the tracemalloc.start() at the beginning of the "main".

fc-mkdocs-malloc-profiling-del-page markdown-01

traefik-official-docs/content$ du -ch *.md ./*/*.md ./*/*/*.md | tail
28K	./routing/providers/kubernetes-gateway.md
24K	./routing/providers/kubernetes-ingress.md
20K	./routing/providers/kv.md
16K	./routing/providers/marathon.md
20K	./routing/providers/rancher.md
4,0K	./routing/providers/service-by-label.md
40K	./routing/routers/index.md
40K	./routing/services/index.md
8,0K	./user-guides/crd-acme/index.md
1,2M	total

@FrancoisCapon
Copy link
Contributor Author

FrancoisCapon commented Nov 16, 2021

Yes, one test failed because the attribute page.markdown no more exist when the assertion check the markdown content.

======================================================================
ERROR: test_populate_page_dirty_modified (tests.build_tests.BuildTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/mkdocs/mkdocs/mkdocs/tests/base.py", line 79, in wrapper
    return fn(self, td, *args)
  File "/home/runner/work/mkdocs/mkdocs/mkdocs/tests/build_tests.py", line 300, in test_populate_page_dirty_modified
    self.assertTrue(page.markdown.startswith('# Welcome to MkDocs'))
AttributeError: 'Page' object has no attribute 'markdown'

----------------------------------------------------------------------
    @tempdir(files={'testing.html': '<p>page content</p>'})
    def test_populate_page_dirty_modified(self, site_dir):
        cfg = load_config(site_dir=site_dir)
        file = File('testing.md', cfg['docs_dir'], cfg['site_dir'], cfg['use_directory_urls'])
        page = Page('Foo', file, cfg)
        build._populate_page(page, cfg, Files([file]), dirty=True)
        # self.assertTrue(page.markdown.startswith('# Welcome to MkDocs'))
        self.assertTrue(page.content.startswith('<h1 id="welcome-to-mkdocs">Welcome to MkDocs</h1>'))

I let the testers update the test so the modification can pass the tests. ✔️

@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Apr 30, 2023

Hi @FrancoisCapon, sorry you didn't get any news on this, and thanks for your patience. In the mentioned issue @oprypin said he wanted to verify the results himself, so I'll let him update us on that (if you're still interested by this memory optimization of course @oprypin. I think we should all be interested in optimizations anyway 😋 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants