Skip to content

Wikilink rendering extremely slow in large workspace with uniqueFilenames enabled #209

@pjeby

Description

@pjeby

Describe the bug
With uniqueNames enabled in a large workspace (>5000 markdown files), rendering markdown previews in VSCode becomes extremely slow: a file with many links can take as much as 30 seconds to render.

To Reproduce

  • Your vscodeMarkdownNotes.workspaceFilenameConvention setting: uniqueFilenames

Steps to reproduce the behavior:

  1. Open a markdown file containing lots of wikilinks
  2. Wait. A long time. :)

Expected behavior
Rendering speed should not be noticeably affected by number of links or workspace size.

It looks like the issue is that it is using noteNamesFuzzyMatch to locate files, but it could instead build a fuzzy list once in a Map, and then just look up the fuzzed version of the link once in it. (At the very least it would be twice as fast if it didn't repeatedly fuzz the link for each file, though 15 seconds is still a really long time to open a preview.) Another alternative might be to simply keep a permanent cache of uri -> fuzzy strings, assuming the issue is the number of regex operations being performed.

Versions

  • OS: Windows 10
  • VS Code Version: 1.98.1
  • Extension Version: 0.0.27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions