Skip to content

Prevent loading the full Markdown package when converting cached markdown fragments #487

@Witiko

Description

@Witiko

In pdfTeX, long documents with many short markdown fragments present a speed challenge, since every fragment loads the whole Markdown package with its requirements and PEG parsers. The cache implemented by the option eagerCache improves the situation by preventing the repeated parsing of the same fragments on subsequent runs. However, the package is still loaded.

We should separate the file markdown.lua into a new file markdown-parser.lua, which would contain most of the current implementation, and a smaller file markdown.lua, which would only contain a skeleton method M.new(). This method would lazily load the Markdown package only when there is a conversion attempt that cannot be satisfied by the cache.

Adding an extra file would make the manual installation somewhat more error-prone and would slightly increase the chance of version mismatch between files. However, it would provide us with some extra breathing room when it comes to speed.

Metadata

Metadata

Assignees

Labels

luaRelated to the Lua interface and implementationspeedRelated to speed improvements

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions