You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected packages and versions
@milkdown/crepe 7.5.7
Link to runnable example
No response
Steps to reproduce
Create or open a large document (~150kb)
Try to paste content or edit any node in the document
Open performance tab in dev tools to observe the slugify method calls
Expected behavior
Document loading and editing should be fast and responsive
Slugify operations should only run when necessary (e.g., for headings)
Performance should not significantly degrade with larger documents
research:
An important note - these method calls were occurring when editing any node, not just headings. For testing, I patched the library's slugify method (@sindresorhus/slugify/index.js) so that instead of its calculations, it would simply return the string 'slugify'. And this immediately solved 2 problems - the initial document loading (paste) happened instantly instead of taking 15 seconds. Document editing began to occur without noticeable delays.
Actual behavior
Initial document loading (paste for 150kb markdown) takes around 15 seconds (MacBook pro M1)
Editing has noticeable delays
Performance tab shows excessive calls to @sindresorhus/slugify/index.js
Slugify is being called on every node change, not just headings
When patched to return a static string 'slugify', performance immediately improves
Document loading becomes instant
Editing becomes responsive without delays
Runtime
Chrome
OS
macOS
Build and bundle tools
Vite
The text was updated successfully, but these errors were encountered:
ValeriyDyachenko
changed the title
[Bug] Performance: Slugify calculations causing significant slowdown in medium/large document loading and editing
[Bug] Performance: Slugify calculations causing significant slowdown in medium/large document initial paste and editing
Dec 23, 2024
Slugify significantly impacts performance, what was the idea behind using it? Why are heading IDs being regenerated in the document on every keystroke, and how are these IDs being used?
Initial checklist
Affected packages and versions
@milkdown/crepe 7.5.7
Link to runnable example
No response
Steps to reproduce
Create or open a large document (~150kb)
Try to paste content or edit any node in the document
Open performance tab in dev tools to observe the slugify method calls
Expected behavior
Document loading and editing should be fast and responsive
Slugify operations should only run when necessary (e.g., for headings)
Performance should not significantly degrade with larger documents
research:
An important note - these method calls were occurring when editing any node, not just headings. For testing, I patched the library's slugify method (@sindresorhus/slugify/index.js) so that instead of its calculations, it would simply return the string 'slugify'. And this immediately solved 2 problems - the initial document loading (paste) happened instantly instead of taking 15 seconds. Document editing began to occur without noticeable delays.
Actual behavior
Initial document loading (paste for 150kb markdown) takes around 15 seconds (MacBook pro M1)
Editing has noticeable delays
Performance tab shows excessive calls to @sindresorhus/slugify/index.js
Slugify is being called on every node change, not just headings
When patched to return a static string 'slugify', performance immediately improves
Document loading becomes instant
Editing becomes responsive without delays
Runtime
Chrome
OS
macOS
Build and bundle tools
Vite
The text was updated successfully, but these errors were encountered: