Closed meskill closed 2 years ago
Hi @meskill, thanks for using my plugin. I'll need some more information to get to the bottom of this.
Obsidian debounces update hooks so it should only recalculate the number of words for the current note once every couple of seconds. It doesn't recalculate any notes other than the one you're currently writing in. However, I could imagine that on notebook-class computers or entry-level Android phones with very long notes, there could very well be some lag. If we can determine for sure what's going on in your case I'd be happy to explore options!
My specs are very decent, so it's not a problem with hardware
Processor Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz 3.60 GHz
Installed RAM 32,0 GB
System type 64-bit operating system, x64-based processor
Without the plugin, most of the tasks performed by obsidian are executed close to 100 ms or less:
While with the plugin some tasks are executed up to 700 ms:
Looking closer to the underperformed task there is lot happening in the plugin while typing:
You can find actual profile data here - novel-word-count.zip
Fascinating - thanks for replying with so much detail. Your computer is twice as fast as mine so you’re right, that’s definitely not the problem. The question remains, then, why I’m not seeing any lag on my five-year-old Windows computer. Possibilities that come to mind:
I've tried obsidian with only your plugin, and it works just fine, so this is definitely a conflict with some other plugin.
If I have some free time, I will try to figure out the conflicting plugin so do not waste your time.
Thanks for checking that out. It might be helpful to look for plugins that do any of the following:
If you're able to figure out which plugin is causing the conflict, I'll be happy to install it and see if there's a way to make them play nice.
I'm closing this issue as I haven't heard anything in several weeks - @meskill, please feel free to open another issue if you discover which plugin is causing a conflict.
I can confirm I am also having this issue and disabling this plugin makes it stop. I'm not yet in a position to determine which plugin it is conflicting with. However, perhaps a delay between refreshing data would be of value? Such as every x
seconds/minutes, and ideally after the last change to a file? That way, drops in performance will only occur when nothing is actually being done inside of the vault. Either that or an option to disable automatic updating and require manual execution of the command?
@DevJake Thanks for your input. There's already a delay (debounce) built into the Obsidian hook for text changes in a file, so without a reproduction of the issue it's hard to know where more work is needed.
As for the ability to turn off automatic recounts, that seems worse than a real fix. It's something I'm willing to implement, but only if 1) I can be certain it fixes the problem and 2) I can't find another fix. So being able to reproduce the issue is a must-have.
Perhaps if you and @meskill can list out all the community extensions you have installed (copy out the contents of .obsidian/community-plugins.json
in your vault) it would narrow things down? E.g. if there are extensions both of your vaults have, we could check those first.
Of course, great thinking. I've included the contents of community-plugins.json
below...
[
"recent-files-obsidian",
"cm-editor-syntax-highlight-obsidian",
"find-unlinked-files",
"obsidian-electron-window-tweaker",
"obsidian-tasks-plugin",
"obsidian-dictionary-plugin",
"table-editor-obsidian",
"calendar",
"nldates-obsidian",
"vantage-obsidian",
"update-time-on-edit",
"obsidian-activity-history",
"obsidian-outliner",
"tag-wrangler",
"markdown-prettifier",
"sliding-panes-obsidian",
"obsidian-image-caption",
"obsidian-smart-typography",
"obsidian-excalidraw-plugin",
"dataview",
"obsidian-footnotes",
"review-obsidian",
"obsidian-leaflet-plugin",
"obsidian-codemirror-options",
"obsidian-embedded-note-titles",
"breadcrumbs",
"obsidian-local-images",
"metaedit",
"templater-obsidian",
"mousewheel-image-zoom",
"emoji-shortcodes",
"obsidian-rollover-daily-todos",
"pane-relief",
"obsidian-copy-block-link",
"number-headings-obsidian",
"better-fn",
"obsidian-contextual-typography",
"obsidian-vault-statistics-plugin",
"file-explorer-note-count",
"folder-note-plugin",
"quickadd",
"cycle-through-panes",
"convert-url-to-iframe",
"settings-search",
"obsidian-pandoc",
"obsidian-git",
"url-into-selection",
"obsidian-admonition",
"file-tree-alternative",
"obsidian-kanban",
"obsidian-annotator",
"obsidian-dynamic-toc",
"obsidian-statusbar-pomo",
"obsidian-gallery",
"obsidian-banners",
"better-word-count",
"obsidian-daily-stats"
]
Let me know if there's anything else I can share to help.
@DevJake thanks, hopefully @meskill will have a moment to share theirs as well.
If you get a few minutes later and want to pin it down on your own, I recommend a binary search to save time. I.e. disable half your plugins, see if the problem persists. Yes => narrow down to the enabled plugins, No => narrow down to disabled plugins. Then repeat. You've got 57 plugins, so it should take about 7 iterations to narrow it down to one plugin (assuming it's just one - to be fair, it could be several).
My list of plugins:
[
"calendar",
"cycle-through-panes",
"cm-editor-syntax-highlight-obsidian",
"obsidian-journey-plugin",
"meld-encrypt",
"smart-random-note",
"review-obsidian",
"obsidian-checklist-plugin",
"slated-obsidian",
"pane-relief",
"tag-wrangler",
"nldates-obsidian",
"templater-obsidian",
"table-editor-obsidian",
"obsidian-admonition",
"obsidian-kanban",
"obsidian-metatable",
"koncham-workspace",
"sliding-panes-obsidian",
"maximise-active-pane-obsidian",
"obsidian-dictionary-plugin",
"obsidian-zoom",
"obsidian-collapse-all-plugin",
"obsidian-vault-changelog",
"quickadd",
"copy-url-in-preview",
"obsidian-cursor-location-plugin",
"plugin-changelogs",
"obsidian-recall",
"customizable-sidebar",
"alx-folder-note",
"obsidian-hide-sidebars-when-narrow",
"theme-picker",
"tag-page-preview",
"quick-explorer",
"customjs",
"hover-external-link",
"drawio-obsidian",
"customizable-menu",
"workspaces-plus",
"cmenu-plugin",
"folder-note-core",
"obsidian-prominent-starred-files",
"obsidian-query-language",
"obsidian-advanced-uri",
"mysnippets-plugin",
"obsidian-pipe-tricks",
"obsidian-limelight",
"obsidian-link-archive",
"obsidian-image-caption",
"customizable-page-header-buttons",
"advanced-cursors",
"obsidian-icon-folder",
"obsidian-icon-shortcodes",
"obsidian-regex-replace",
"obsidian-memos",
"obsidian-snippetor",
"obsidian-image-toolkit",
"obsidian-dynamic-highlights",
"obsidian-style-settings",
"obsidian-divide-and-conquer",
"dataview",
"settings-search",
"tag-word-cloud",
"obsidian-linter",
"obsidian-better-command-palette",
"persistent-graph",
"big-calendar",
"creases",
"markdown-table-editor",
"obsidian-remember-file-state",
"obsidian-quiet-outline",
"lapel",
"obsidian-format-code",
"obsidian-card-view-switcher-plugin",
"obsidian-paste-image-rename",
"macro-plugin",
"obsidian-latex-suite",
"tabout",
"obsidian-scroll-offset",
"typing-speed",
"obsidian-banners",
"obsidian-map-view",
"hotkey-helper",
"obsidian-git",
"obsidian-sortable",
"zoottelkeeper-obsidian-plugin",
"periodic-notes",
"obsidian-another-quick-switcher"
]
I've been trying to use divide & conquer plugin to find out the cause with binary search but didn't succeed as I'm not sure it works as intended.
And the list of intersected plugins with @DevJake is next:
[
"calendar",
"cycle-through-panes",
"cm-editor-syntax-highlight-obsidian",
"review-obsidian",
"pane-relief",
"tag-wrangler",
"nldates-obsidian",
"templater-obsidian",
"table-editor-obsidian",
"obsidian-admonition",
"obsidian-kanban",
"sliding-panes-obsidian",
"obsidian-dictionary-plugin",
"quickadd",
"obsidian-image-caption",
"dataview",
"settings-search",
"obsidian-banners",
"obsidian-git"
]
Thanks @meskill, I think there's enough info here to reopen the issue.
@meskill @DevJake The list of intersecting plugins between you two looks pretty manageable. I'm going to do a bit of research and then go try to reproduce the issue.
A couple of things you two could do to help:
Research notes follow.
calendar Visual, conflict unlikely Shows a calendar widget that links to notes by creation date.
cycle-through-panes Navigation, conflict unlikely Keyboard binding for switching tabs.
cm-editor-syntax-highlight-obsidian Content, conflict likely Syntax highlighting in code blocks.
review-obsidian Scheduling, linking, conflict likely Set a note to be linked from a future (or past) note.
pane-relief Navigation, conflict unlikely Nav history and hotkeys for navigating between panes.
tag-wrangler Linking, conflict likely Extended tag functionality with "tag pages" that update themselves (?).
nldates-obsidian Contextual suggestions, conflict unlikely Inserts dates and note links based on natural language e.g. "next week".
templater-obsidian Dynamic code, conflict unlikely Tampermonkey for Obsidian.
table-editor-obsidian Content, conflict unlikely Easier markdown tables.
obsidian-admonition Content, conflict unlikely Material-design callout blocks.
obsidian-kanban Content and linking, conflict likely Trello in Obsidian.
sliding-panes-obsidian Visual, conflict unlikely Split editor.
obsidian-dictionary-plugin Context, conflict unlikely Contextual dictionary/thesaurus.
quickadd Scripting and interop, conflict likely Captures various types of content to a new note, includes scripting abilities.
obsidian-image-caption Content, conflict unlikely Add captions to images.
dataview Scripting, linking, conflict very likely SQL-like inline queries that link notes as result sets.
settings-search Settings, conflict unlikely Adds a search bar to the settings window.
obsidian-banners Content, conflict unlikely Insert banner headers in documents.
obsidian-git Backup, conflict unlikely Automatically backs up/restores vault with Git.
So at this point my top suspects are:
I have just tested all of the mutual plugins. I initially disabled the 'top suspects' list one by one, with no success. I then disabled the full list of 19 items one by one, again with no success. I then disabled the entire list, restarted Obsidian, then tried, and the lagging during typing issue persists. The issue only went after disabling the novel word count plugin.
This would lead me to believe that it may not be a plugin conflict. As you noted, the plugin does not lag for your own vault. However, I am not sure of the size of your vault. My vault is (currently) 1,720 notes across 1,259 folders, mixed with 23,256 total files, totalling to 8.47GB. I have also included a line and file count for each programming-related file type within the vault.
I believe it may simply be a product of the size of the vault and the amount of time it takes to check all of the files. Maybe some sort of caching would be of use? To only perform checks on files that have recently changed, not the entire vault.
Let me know if there's any more testing I can do to help.
@DevJake Thanks for taking the time to do that. In theory at least, the plugin already does what you're describing.
Earlier on in the conversation @meskill said:
I've tried obsidian with only your plugin, and it works just fine, so this is definitely a conflict with some other plugin.
Are you saying you're getting lag when all plugins except novel-word-count are disabled?
In theory at least, the plugin already does what you're describing.
That's good to hear. Equally, somewhat unfortunate to hear, since it means the issue stems from some other unknown reason...
Are you saying you're getting lag when all plugins except novel-word-count are disabled?
I get the lag when all of the 19 listed mutual plugins are disabled. I have not tried disabling all of my plugins. Given that the plugins I did disable are all of the ones overlapping with meskill's list, then I very much doubt it would be the product of another plugin since there is no correlation there
It's possible there are multiple plugins out there that independently have conflicting behavior with this one, but you're right, this does make that seem somewhat less likely.
I'm going to ship a "Debug mode" in the plugin that will output some information to the console. And then if you can take a moment to reproduce the issue, open your Obsidian developer console, and send me a screen/text capture of the output, hopefully that will give some indication of where the issue is coming from.
Hang tight in the meantime, I'll update here when I've shipped the update.
Sounds like a great plan to me. Cheers 👏
Well, I owe you two an apology. As soon as I implemented debug mode it became clear that a couple things weren't working the way I thought they were. In particular, a bug in the way I was using the cache was resulting in a complete recalculation of the vault on each file change.
Release 2.4.0 fixes these issues and a couple others. I expect there will be significant performance improvements on large vaults. Please try it out and let me know how it goes.
If there are more issues, the new debug mode provides plenty of detail in the dev console so we can track them down faster.
Hey, no worries. I'm glad we managed to help you find the bug! I've now installed the new release and can confirm it has fixed all issues of typing lag. Brilliant work, thank you! 👏👏
Great, I'm glad to hear it. @meskill feel free to report back as well, we can reopen the issue if you're still seeing lag.
works well, thank you for the fix
Hello, thanks for the plugin.
But I have an issue with the plugin when I'm typing fast there are noticeable freezes for the obsidian interface.
For me, there is no need to update the info so often, so maybe a new setting option to update only on save will help.