milos-linux/tools/lib/python/kdoc
Mauro Carvalho Chehab 79d881beb7 docs: kdoc_parser: avoid tokenizing structs everytime
Most of the rules inside CTransforms are of the type CMatch.

Don't re-parse the source code every time.

Doing this doesn't change the output, but makes kdoc almost
as fast as before the tokenizer patches:

    # Before tokenizer patches
    $ time ./scripts/kernel-doc . -man >original 2>&1

    real    0m42.933s
    user    0m36.523s
    sys     0m1.145s

    # After tokenizer patches
    $ time ./scripts/kernel-doc . -man >before 2>&1

    real    1m29.853s
    user    1m23.974s
    sys     0m1.237s

    # After this patch
    $ time ./scripts/kernel-doc . -man >after 2>&1

    real    0m48.579s
    user    0m45.938s
    sys     0m0.988s

    $ diff -s before after
    Files before and after are identical

Manually checked the differences between original and after
with:

    $ diff -U0 -prBw original after|grep -v Warning|grep -v "@@"|less

They're due:
  - whitespace fixes;
  - struct_group are now better handled;
  - several badly-generated man pages from broken inline kernel-doc
    markups are now fixed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <1cc2a4286ebf7d4b2d03fcaf42a1ba9fa09004b9.1773770483.git.mchehab+huawei@kernel.org>
2026-03-22 15:02:29 -06:00
..
__init__.py
c_lex.py docs: c_lex: setup a logger to report tokenizer issues 2026-03-22 15:02:29 -06:00
enrich_formatter.py docs: kdoc: enrich_formatter: Improve docstrings and comments 2026-01-23 11:37:38 -07:00
kdoc_files.py docs: kdoc_files: document KernelFiles() ABI 2026-03-09 10:23:20 -06:00
kdoc_item.py docs: kdoc_item: Improve docstrings and comments 2026-01-23 11:37:38 -07:00
kdoc_output.py docs: kdoc_output: better handle lists 2026-03-09 10:34:39 -06:00
kdoc_parser.py docs: kdoc_parser: avoid tokenizing structs everytime 2026-03-22 15:02:29 -06:00
kdoc_re.py docs: kdoc_re: get rid of NestedMatch class 2026-03-22 15:02:29 -06:00
latex_fonts.py docs: kdoc: latex_fonts: Improve docstrings and comments 2026-01-23 11:37:38 -07:00
parse_data_structs.py docs: kdoc: parse_data_structs: Improve docstrings and comments 2026-01-23 11:37:38 -07:00
python_version.py docs: kdoc: python_version: Improve docstrings and comments 2026-01-23 11:37:38 -07:00
xforms_lists.py docs: kdoc_parser: avoid tokenizing structs everytime 2026-03-22 15:02:29 -06:00