Obsidian-Code-Styler icon indicating copy to clipboard operation
Obsidian-Code-Styler copied to clipboard

Bug: performance issues

Open olearydj opened this issue 2 years ago • 56 comments

While Code Styler is enabled my Obsidian performance is significantly affected. Keyboard response, file opening, etc. are all noticeably delayed. When I disable OCS, these symptoms go away.

Describe the bug

See above.

Steps to reproduce

See above.

n/a

Expected behaviour

Don't hinder app responsiveness.

Current behaviour

Distracting enough that I have to disable an otherwise awesome plugin. ☹️

Environment

  • Plugin Version: 1.0.7
  • Obsidian Version: 1.4.3 / 1.3.5 installer
  • Platform: desktop
  • OS: macos 13.4.1(c)
  • Theme: minimal
  • CSS Snippets: a few simple ones (4) plus what is automatically generated by supercharged links plugin

16" 2019 MacBook Pro with 2.3g 8-core intel and AMD radeon pro 5500m (8gb); 32gb ram I've never reported a performance bug before, so I'm not one of those guys.

Additional context

No console errors. I'm happy to provide any other logs / data you need to consider / address this issue. Thanks for a great, beautiful plugin.

Dan

olearydj avatar Aug 17 '23 16:08 olearydj

Sorry, is version 1.4.3 an insider version?

Have you used any version of the plugin before 1.0.7? Were the issues still present? Could you try making a new vault and seeing if the performance persists? If it does, I'd still be interested in solving why its affecting performance for you but It'd be nice to know the whole thing isn't buggy haha.

Lastly, if the problem does persist, could you try close all notes apart from one reading mode note and see if the symptoms are still there, and also then separately try just one editing mode note and see if the symptoms remain.

Did you try and disable all other plugins than this plugin? (I know that's tedious so no worries if not).

mayurankv avatar Aug 17 '23 16:08 mayurankv

It seems ok in a sandbox with just OCS installed.

I previously reported a couple of bugs that you fixed in earlier versions. I've experienced "laggy" performance from the first use, but wasn't certain it was due to OCS. I've enabled and disabled it several times since, each time sensing the issue enough to disable it again. It is not a dramatic slowdown, but enough to be distracting. v1.4.3 is an insider version.

I recorded a test in my main vault. First I closed all notes, restarted Obsidian, and then started recording the video. https://share.cleanshot.com/3FPHdpQW

Maybe a result of interaction with other plugins, etc. Can I dump any performance related data for you? I can do more testing with some plugins deactivated, etc. later but don't have the time right now.

Thanks for the quick support as always.

olearydj avatar Aug 17 '23 17:08 olearydj

Huh, I'm afraid I'm going to have to take some time working out what the issue could be. I'll first try to replicate it if possible. Will likely ask a few questions over the next few days.

mayurankv avatar Aug 17 '23 17:08 mayurankv

Honestly, that is really surprising, I've not noticed any effects similar to that video. Do the symptoms also occur in reading mode?

mayurankv avatar Aug 17 '23 17:08 mayurankv

Sorry for the troubling news. It is hard to tell if the effects persist in reading mode, because it is most noticeable when I type, etc.

But when checking to confirm that I noticed that my code blocks aren't actually getting the OCS styling in reading mode. This must be a new problem as I would have noticed it before. I've attached a new video that shows that. Also, when I deactivate OCS, the live preview mode gets corrupted. See video.

https://share.cleanshot.com/V1Yx9wm5

olearydj avatar Aug 17 '23 17:08 olearydj

Thanks again for the detailed report. I had actually noticed when doing extensive testing that sometimes half the page would load before I scrolled and then the rest would suddenly appear so I agree there must be some significant internal issue regarding that. For the reading mode, are you definitely not getting error outputs in your command log?

mayurankv avatar Aug 18 '23 07:08 mayurankv

I just repeated the entire process in the prior video with the dev tools opened. No errors or warnings were popped.

olearydj avatar Aug 18 '23 12:08 olearydj

I also noticed the text / styles popping in while scrolling in Reading mode with OCS active.

olearydj avatar Aug 18 '23 12:08 olearydj

Would it be possible to list the active plugins you're using?

I must say I'm at a bit of a loss on where to start with this. I'll try and identify why things may not completely render instantly with reading mode for some clues. Also editing mode may just be running a bit too intensively causing the performance issues. But reading mode not applying at all with no errors at all is weird.

mayurankv avatar Aug 18 '23 14:08 mayurankv

Could you send me the content of the note that breaks as well?

mayurankv avatar Aug 18 '23 14:08 mayurankv

Happy to provide whatever you need.

python-virtual-environments.md

SYSTEM INFO:
	Obsidian version: v1.4.3
	Installer version: v1.3.5
	Operating system: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 22.5.0
	Login status: logged in
	Catalyst license: vip
	Insider build toggle: on
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: Minimal v7.2.0
	Snippets enabled: 5
	Restricted mode: off
	Plugins installed: 49
	Plugins enabled: 41
		1: Dataview v0.5.56
		2: File Tree Alternative Plugin v2.3.5
		3: Admonition v10.0.1
		4: Auto Link Title v1.4.1
		5: Advanced Tables v0.19.1
		6: Better Word Count v0.10.0
		7: Advanced Slides v1.20.0
		8: Divide & Conquer v1.0.0
		9: floating toc v2.3.0
		10: File Creation and Last Modified Timestamps in Status Bar v1.2.0
		11: Another Quick Switcher v8.14.0
		12: Zotero Integration v3.0.7
		13: Pandoc Reference List v2.0.19
		14: Hide Sidebars on Window Resize v1.1.0
		15: Plugin Update Tracker v1.5.2
		16: Share as Gist v1.2.1
		17: Text Format v2.2.7
		18: Wikipedia v1.0.3
		19: Hider v1.3.1
		20: Hotkey Helper v0.3.18
		21: Kanban v1.5.3
		22: Linter v1.19.1
		23: Longform v2.0.3
		24: Minimal Theme Settings v7.2.1
		25: Note Refactor v1.7.1
		26: Pandoc Plugin v0.4.1
		27: Pane Relief v0.5.1
		28: Quick Explorer v0.2.8
		29: Readwise Official v2.0.1
		30: Recent Files v1.3.7
		31: Regex Find/Replace v1.2.0
		32: Settings Search v1.3.8
		33: Sortable v0.3.1
		34: Style Settings v1.0.6
		35: Supercharged Links v0.10.0
		36: Tag Wrangler v0.5.11
		37: Templater v1.16.0
		38: Text Generator v0.3.20
		39: Force note view mode v1.2.0
		40: Obsidian Git v2.20.7
		41: Default New Tab Page v0.11.0

RECOMMENDATIONS:
	Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

olearydj avatar Aug 18 '23 17:08 olearydj

It's a lot of plugins. I can do some divide and conquer testing this weekend if you like. It might not completely isolate the problem but could save a lot of time.

olearydj avatar Aug 18 '23 17:08 olearydj

That would be very helpful if you get the time! I'm trying to get the next release done and then I'll try and focus on this. Thank you for all the info!

mayurankv avatar Aug 20 '23 18:08 mayurankv

I doubt this has been resolved with the latest release?

mayurankv avatar Aug 25 '23 12:08 mayurankv

I haven't had a chance to check it yet. Will do so this weekend and provide some divide and conquer findings if not. Sorry for going quiet - I'm trying to finish my PhD this semester while teaching a full load and had to travel last weekend.

olearydj avatar Aug 25 '23 13:08 olearydj

Oh no rush at all! Best of luck with the PhD and teaching!

mayurankv avatar Aug 25 '23 23:08 mayurankv

FYI some rather large changes have been made to how the live preview part of the plugin works with the last two versions. Though I'm not actually sure whether it improves or detracts from performance (as I've never had an issue with it either way). Would be interested to hear how you feel when you get the chance!

mayurankv avatar Aug 25 '23 23:08 mayurankv

Hey, I'm really sorry I haven't been able to get back to this. It is still on my list and I plan to this weekend. Meanwhile I've noticed the latest version fails to install when upgrading in the plugin panel.

olearydj avatar Aug 30 '23 20:08 olearydj

Hi, honestly no worries at all! I actually just released a new version and tested that I could update from a previous version. Not sure if the last release had issues. Could you check if this one works?

mayurankv avatar Aug 30 '23 21:08 mayurankv

Hey! Yes, I was able to get the next version installed without issues. with the 1.4.5 version rolled out to everyone, I'm hopeful we can get to the bottom of this - I'll get you an update this weekend

On Fri, Aug 25, 2023 at 6:04 PM Mayuran Visakan @.***> wrote:

FYI some rather large changes have been made to how the live preview part of the plugin works with the last two versions. Though I'm not actually sure whether it improves or detracts from performance (as I've never had an issue with it either way). Would be interested to hear how you feel when you get the chance!

— Reply to this email directly, view it on GitHub https://github.com/mayurankv/Obsidian-Code-Styler/issues/91#issuecomment-1694019133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKF2CW2XCXF3COQGK55DUXDXXEVRVANCNFSM6AAAAAA3UKU5WA . You are receiving this because you authored the thread.Message ID: @.***>

olearydj avatar Sep 01 '23 18:09 olearydj

Hi, I'm experiencing a similar performance issue. Most of the operations in Obsidian feel laggy after OCS is enabled.

I've tried disabling the plugins I am using one by one and found out that disabling the "Excalidraw" plugin will fix the performance issue in my case. It's worth mentioning that before installing OCS, I hadn't noticed any kind of performance issue while using the "Excalidraw" plugin.

Here is the system info when encountering the issue:

Plugin Version: 1.0.11

{
  "process": {
    "obsidian-version": "1.4.16",
    "obsidian-installer": "1.4.13",
    "platform": "desktop",
    "os": "windows11",
    "theme": "minimal"
  },
  "app": {
    "internalPlugins": {
      "config": {
        "file-explorer": true,
        "global-search": true,
        "switcher": true,
        "graph": true,
        "backlink": true,
        "outgoing-link": true,
        "tag-pane": true,
        "page-preview": true,
        "daily-notes": false,
        "templates": false,
        "note-composer": false,
        "command-palette": true,
        "slash-command": false,
        "editor-status": false,
        "starred": true,
        "markdown-importer": false,
        "zk-prefixer": false,
        "random-note": false,
        "outline": true,
        "word-count": false,
        "slides": false,
        "audio-recorder": false,
        "workspaces": true,
        "file-recovery": true,
        "publish": false,
        "sync": false,
        "canvas": true,
        "bookmarks": true,
        "properties": true
      }
    },
    "plugins": {
      "enabledPlugins": [
        "smart-random-note",
        "note-refactor-obsidian",
        "hotkeysplus-obsidian",
        "better-word-count",
        "periodic-notes",
        "table-editor-obsidian",
        "cm-typewriter-scroll-obsidian",
        "tag-wrangler",
        "dataview",
        "obsidian-outliner",
        "obsidian-style-settings",
        "templater-obsidian",
        "obsidian-git",
        "calendar",
        "obsidian-admonition",
        "obsidian-minimal-settings",
        "obsidian-hider",
        "obsidian-footnotes",
        "open-vscode",
        "obsidian-linter",
        "metadata-menu",
        "tag-navigator",
        "obsidian-contextual-typography",
        "obsidian-memos",
        "obsidian-advanced-slides",
        "obsidian-regex-pipeline",
        "excalibrain",
        "various-complements",
        "darlal-switcher-plus",
        "cm-chs-patch",
        "omnisearch",
        "obsidian-hover-editor",
        "obsidian-filename-heading-sync",
        "pane-relief",
        "nldates-obsidian",
        "url-into-selection",
        "workspaces-plus",
        "obsidian-icon-folder",
        "obsidian-paste-png-to-jpeg",
        "obsidian-snippet-downloader",
        "obsidian-quiet-outline",
        "obsidian-textgenerator-plugin",
        "obsidian42-brat",
        "yank-highlight",
        "obsidian-plugin-prettier",
        "code-emitter",
        "graph-analysis",
        "ninja-cursor",
        "easy-typing-obsidian",
        "code-styler",
        "obsidian-excalidraw-plugin"
      ]
  }
}

noidilin avatar Nov 22 '23 06:11 noidilin

Hi! Thanks for letting me know. That's really annoying. Just to double check, if you update to the new release the issue still persists right? One more question, does the issue still persist in a new vault with just Excalidraw and OCS installed?

mayurankv avatar Nov 26 '23 22:11 mayurankv

@olearydj Just to check, are you still having any performance issues at all? No worries if you haven't got any further info.

mayurankv avatar Nov 26 '23 22:11 mayurankv

I just tested in a vault with a clean setup, and both the “Excalidraw” and OCS plugins are updated. Unfortunately, I found out that actually Obsidian became pretty laggy after I enabled the “Excalidraw” plugin. Since I haven’t used a brand new vault for a long time, I didn’t notice the performance impact before.

Moreover, by enabling more plugins that function in edit mode, the performance drop is continuously increasing. Therefore, the experience that I am having might be the compound result of multiple plugins, but most of it is contributed by “Excalidraw” and then secondly by the OCS plugin.

noidilin avatar Nov 27 '23 02:11 noidilin

I'm always interested in performance issues so I will try and have a look as to how any issues might be arising.

Does enabling OCS after exalidraw affect performance any more than any other plugin after excalidraw? i.e. the execute code plugin or dataview or any others?

mayurankv avatar Nov 27 '23 02:11 mayurankv

It is quite hard to explain the laggy behavior, so I recorded a video with the newly created vault and other plugin enabled. There is a keycast indicator showing what key I have pressed or I am currently holding.

https://github.com/mayurankv/Obsidian-Code-Styler/assets/40153468/b0af951f-b8d2-4c1a-a3f1-52f4024b951b

During this video, I have done these operation:

  1. Use arrow key to move in source mode with OCS and excalidraw disabled.
  2. Enable Excalidraw. You can see the cursor behavior not syncing with keypress (especially when I holding arrow key).
  3. Disable Excalidraw and reload obsidian.
  4. Enable OCS and the cursor behavior still not syncing with keypress.
  5. Enable Excalidraw with OCS enabled. The issue become more noticable.

In my personal experience, most significant performance impact comes from the OCS and Excalidraw plug-ins.

noidilin avatar Nov 27 '23 15:11 noidilin

I did some testing on this, so I had an empty file where I had a macro type like 20 characters (almost no delay between). No plugins except OCS, toggling on/off Theme and CSS

Results: Using OCS will introduce severe typing lag especially with multiple CSS-Snippets like MCL or some of my custom ones. However, this happens when I have a "more complex" file open. Empty file with no sidebar - no lag Empty file with complex file in sidebar - severe lag (800ms) Complex file with no sidebar - severe lag (800ms)

When I say "complex", I'm talking about some headers, some task lists and some links. Not more than that. And at no point in those tests I had somewhere a code snippet in view or file.

roman-balzer avatar Feb 21 '24 02:02 roman-balzer

Hi, thanks so much for this, it'd be great to tackle this. Would it be possible for you to provide some of the snippets and files for which the lag was noticeable?

mayurankv avatar Feb 21 '24 02:02 mayurankv

I'm still trying to narrow it even more down, since the CSS also does introduce a good amount of lag. But like I mentioned even with no CSS and no Theme, the rendering goes from ~70ms to ~115ms in my tests.

As for CSS, MCL's CSS had a really noticeable effect on the rendering performance alongside OCS. As for the file, I'd rather not share my private ToDo list, but like I said, it's really just a File with Headers, TasksList, some links internal and external, maybe 80-100 lines.

roman-balzer avatar Feb 21 '24 02:02 roman-balzer

No worries, I'll try and create a similar file and see if I can reproduce this. Thanks for mentioning the CSS and any further information you do fine would definitely be helpful in fixing this. This will probably be my first priority to fix if I can reproduce it (hopefully over the next few days). By any change are the css files that get cumbersome ones that define colours? Also one more question, how are you measuring the rendering time? That would be really helpful for me to test as well!

mayurankv avatar Feb 21 '24 03:02 mayurankv