Edwin Edwin -4 years ago 232
C# Question

WPF and CefSharp: sluggish performance

I have successfully made a personal mini browser app in c# winforms.
Because I want some more fancy effects, I was considering to make a WPF app. So I tried the wiki tutorial and set up a simple WPF form with a browser, but noticed it has sluggish performance. It's even noticeable when selecting text in very simple webpage, or just when scrolling the page. Is there anything that can be done? If not, I guess it will be just winforms then, since that one behaves and performs well.

edit: my specs: http://users.telenet.be/dropbox/specs.html

Answer Source

WPF version of cefsharp uses different model of rendering than WinForms. In WPF it basically copies each frame into bitmap and you might imagine how slow it can become. This is especially noticeable on high-resolution screens. There are some options to improve that perfomance (see here for example), but in my experience (I tried all that options) non of them really helps to match WinForms. To run cefsharp smoothly in my WPF project I actually had to use WinForms version of cefsharp and host it inside WindowsFormsHost - this helps with perfomance problems but has it's caveats of course (for example you cannot partially hide WinForms hosted control behind WPF controls - it will always be rendered on top of everything). Still for now I consider this the only viable option, because high-resolution screens are now quite widespead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download