Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macSVG rendering performance needs x10 improvement #3

Open
johnblommers opened this issue Apr 5, 2017 · 2 comments
Open

macSVG rendering performance needs x10 improvement #3

johnblommers opened this issue Apr 5, 2017 · 2 comments

Comments

@johnblommers
Copy link

Unzip and open the attached file pattern.svg.zip with macSVG and you will observe how slow the rendering engine is. Dropping the same file onto the Chrome web browser renders the image almost instantly. Hopefully the migration to Swift and perhaps an eye to the SVG rendering engine will provide a much-needed rendering boost. As it stands right now there is considerable time spent in the BBOD.
pattern.svg.zip

@dsward2
Copy link
Owner

dsward2 commented Apr 17, 2017

johnblommers - Thanks for your note and link to an interesting SVG file, which contained many "use" elements.

I found the main slowdown to be during the initial loading of the pattern.svg document. It was taking 20 seconds, which was clearly too long.

I found this line in MacSVGDocumentWindowController.m, at line 1065 -

[self.xmlOutlineController expandAllNodes];

After that line was disabled, your pattern.svg document loaded much faster. In the user interface, it means that the hierarchical outline view of the SVG document will be fully collapsed when the document is open.

I'll commit a couple of line changes to the repository and do further testing. The expandAllNodes call when the document is opened might become a conditional operation depending on the number of elements the SVG document. It will likely be included in the next release.

The rendering speed in this SVG editing application will always be slower than in a web browser. Although this project is moving to Swift language, that probably won't affect the rendering speed much.

Some of the slower rendering is due to unnecessary multiple updates of the web view and other views. Those can be fixed in the future by deferring screen updates to the end of the event cycle.

Another possibility for faster performance is to fork WebKit and restore the old Objective-C APIs for SVG which Apple removed a few years ago, or at least exposing some WebCore properties and functions for custom usage. But maintaining a separate fork of WebKit would be a big project. Currently, macSVG uses the standard WebKit framework in macOS.

@jarek-foksa
Copy link

You could improve performance by moving to WebKit 2 / WKWebView. I wouldn't bet too much on the synchronous WebKit 1 API as it's very likely going to be deprecated in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants