PKM-er / obsidian-editing-toolbar

An obsidian toolbar plugin, modified from the Cmenu plugin
Mozilla Public License 2.0
848 stars 30 forks source link

unnecessarily high CPU acceleration due to third party dependency #175

Open GottZ opened 2 months ago

GottZ commented 2 months ago

Describe the bug unnecessary cpu acceleration through a third-party plugin

To Reproduce Steps to reproduce the behavior:

  1. enable the plugin
  2. cold start obsidian
  3. open task manager and wait for obsidian to settle down
  4. open obsidian debug tools via ctrl + shift + i and gather performance metrics

Expected behavior 0% cpu usage

Screenshots Obsidian without obsidian-editing-toolbar: image Obsidian with obsidian-editing-toolbar: image burn-down of performance metrics: image cause, as identified by metrics: image

Desktop (please complete the following information):

Additional context I could pin down the issue to this code: https://github.com/simonwep/pickr/blob/39b4d82068578c306714570a24cb0ab470ffb154/src/js/pickr.js#L147-L173 there once was a related pull request: https://github.com/simonwep/pickr/pull/233 please try to use this library in a way, where it doesn't cause a infinite loop.

ITMighty commented 2 months ago

For the last month or so I've been experiencing sluggish performance with Obsidian. I finally narrowed it down to this plugin. Unlike @GottZ, I don't know what or how to fix it, but any number of plugins can be enabled with seemingly no performance hit to Obsidian. Once this plugin is enabled, however, all hell breaks loose. It can get so bad I can type a whole sentence into a note before it appears on screen.

GottZ commented 1 month ago

image this is how I actually fixed it for myself. it just reduces calling this on every animation frame to every 5 seconds. I don't know why it's required or why it fails since I didn't dig into pickr yet, but in case you want an easy replacement for .obsidian/plugins/editing-toolbar/main.js, just diff the following against your main.js, to ensure I did not inject anything malitious: main.zip

cc @ITMighty

zanodor commented 1 month ago

image this is how I actually fixed it for myself. it just reduces calling this on every animation frame to every 5 seconds. I don't know why it's required or why it fails since I didn't dig into pickr yet, but in case you want an easy replacement for .obsidian/plugins/editing-toolbar/main.js, just diff the following against your main.js, to ensure I did not inject anything malitious: main.zip

cc @ITMighty

Gott-Sent! Vielen dank,

Z.

GottZ commented 2 weeks ago

@cumany please take a look

WarmWelcome commented 2 weeks ago

Just installed obsidian and gave this a try. Love the features that it offers, but it immediately became very sluggish and unusable with it. Could this be fixed, please?

Temporary resolutions for the lazy (like me):