Developer-Mike / obsidian-advanced-canvas

⚡ Supercharge your Obsidian.md canvas experience! Create presentations, flowcharts and more!
GNU General Public License v3.0
259 stars 13 forks source link

[BUG] Portal Performance Optimisation #95

Open itsonlyjames opened 1 month ago

itsonlyjames commented 1 month ago

Tried the script referenced here: https://forum.obsidian.md/t/performance-issue-with-canvas-when-panning-out-of-region-with-a-large-number-of-nodes/68609/6, found with portals active it created a jarring flashing effect and made performance worse.

Then tried turning on the performance optimisation within Advanced Canvas, and noticed the same issue. I suspect it's using the same code under the hood.

It's only relatively slow to move around with this below canvas, so it's a non-issue performance wise right now; and I am for sure pushing the limits of maybe what portals are capable of.

Auditory Processing

Developer-Mike commented 4 weeks ago

This is the exact same CSS snippet, Advanced Canvas also uses. Unfortunately, I couldn't replicate the flashing effect you've encountered. I always try to optimize Advanced Canvas as best as possible, but there are no specific plans to improve the "native" Canvas performance directly, due to it using minified code that makes rewrites nearly impossible.

itsonlyjames commented 4 weeks ago

Are you saying the performance toggle (CSS snippet) has a positive effect for you? I minified it to only this plugin, so as to remove any possibility of a conflict, yet the bug persisted.

Here are but a couple of examples of the flashing with the toggle enabled.

Aug-16-2024 23-04-22 Aug-16-2024 23-04-05

Update: it's definitely related to portals... I just played snake with a canvas and had no flashing. It brought my framerate to a halt, but nevertheless, it's a bug related to the CSS snippet and portals.

Aug-16-2024 23-13-43

I love the concept and implementation of portals, yet am worried about the longevity and future proofing. Do you foresee it becoming a native solution? What would you suggest be the best solutiont to the performance woes?

Developer-Mike commented 4 weeks ago

Thank you for confirming that the issue is related to the portals feature.

I really want to make portals a core feature of this plugin, and I'll definitely try to improve the performance of it. But keep in mind that I won't have a lot of time until November.

While I highly doubt that portals will ever be implemented in the inbuilt Canvas plugin, I don't think it isn't future-proof. Even if this plugin stops working one day (and there is no active fork), the portals will become ordinary file nodes and the only data-loss (the data isn't gone, just not displayed) would be the connections between the normal nodes and the portal ones.

itsonlyjames commented 4 weeks ago

Thanks for the confidence boost in regards to the future proofing. You're right, given the JSON Canvas spec, the portals are additive and do not detract from the core experience. I visualise this as the escalator vs elevator approach to programming.

Portals are absolutely incredible, it's almost like the infinite zoom feature of Procreate; I can have a flow diagram of how hair cells transduce energy, which then links up to the anatomy of the scala media, and then all the way up to the anatomical structure of the cochlea. All seperated, but connected.

I optimistically think it will become a native feature as the core team see your efforts—the idea of embedding canvas' inside canvas' is just too appealing to not dedicate resources to.

I'm aware of your schedule, and am invested enough in this to dig through the code also to see what I may contribute. Thanks for reopening this issue.

Developer-Mike commented 4 weeks ago

Feel free to open a PR at any time 😁. Most of the portal code is located inside this file.