Welcome Guest Search | Active Topics | Sign In | Register

webbrowser control new webview initial load time long Options
jeff
Posted: Friday, June 13, 2014 7:30:09 PM
Rank: Newbie
Groups: Member

Joined: 6/2/2014
Posts: 5
My app is a winform app that contains a form with tabcontrol for browser tabs.

Overall is running pretty well, with one minor issue.
When tab goes to new URL( new tab, or typed replacement URL ),
the initial load time is 2-3 second for even 'www.google.com', which loads in chrome instantaneousely.

Is this an issue a know issue, or am I doing something wrong?
======================================================================================================

When I create new tab, I create a new webbrowser control and a new webview which I assign to the new web browser control, and wire events.

Snipet below:
public delegate void StatusChanged( TabPage tabpage );
public delegate void UrlChanged( TabPage tabpage, string url );
public delegate void NewWindowOpened( TabPage tabpage );
public delegate void OnDownload( TabPage tabpage );
public delegate void BrowserTabNavigating( BrowserTabEventArgs browerArgs );
public class BrowserTabPage : TabPage
{
public WebControl webBrowser = new WebControl();
public static StatusChanged StatusChangeDelegate;
public static UrlChanged UrlChangeDelegate;
public static NewWindowOpened NewBrowserWinOpenedDelegate;
public event BrowserTabNavigating BrowserNavigatingEvent;
public BrowserTabPage()
{
webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
webBrowser.Location = new System.Drawing.Point( 3, 3 );
webBrowser.MinimumSize = new System.Drawing.Size( 20, 20 );
webBrowser.Name = "EOBrowser";
webBrowser.Size = new System.Drawing.Size( 651, 234 );
webBrowser.TabIndex = 0;
webBrowser.WebView = new WebView();
webBrowser.WebView.StatusMessageChanged += new EventHandler( webBrowser_StatusTextChanged );
webBrowser.WebView.TitleChanged += new EventHandler( webBrowser_DocumentTitleChanged );
webBrowser.WebView.BeforeNavigate += new BeforeNavigateHandler( webBrowser_Navigating );
webBrowser.WebView.NewWindow += new NewWindowHandler( webBrowser_NewWindow );
webBrowser.WebView.BeforeDownload += new BeforeDownloadHandler( WebView_BeforeDownload );
webBrowser.WebView.Activate += new EventHandler( webBrowser_Activate );
webBrowser.WebView.FileDialog += new FileDialogHandler( WebView_FileDialog );
webBrowser.WebView.LaunchUrl += new LaunchUrlHandler( WebView_LaunchURL );
webBrowser.WebView.BeforeRequestLoad += new BeforeRequestLoadHandler( WebView_BeforeRequestLoad );
webBrowser.WebView.UrlChanged += new EventHandler( WebView_UrlChanged );
webBrowser.WebView.JSDialog += new JSDialogEventHandler( WebView_JSDialog );
Controls.Add( webBrowser );
}
....
}
eo_support
Posted: Friday, June 13, 2014 7:54:49 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

This is a known issue and we are working on it. The root of the problem is we load native code in memory instead of from a different native DLL. The advantage of our method is that you only get one .NET dll and you do not have to have a different native DLL. But the disadvantage is we load slower since when there is a native DLL, the OS loads that DLL and the OS loader is very well optimized at the OS kernel level. We are working on this part trying to implement some optimizations strategy implemented by the OS loader so that we can load faster.

Thanks!
Psych971
Posted: Saturday, June 14, 2014 1:02:23 AM
Rank: Newbie
Groups: Member

Joined: 6/14/2014
Posts: 2
Hi, I've been noticing a severe lag in the initial load as well. Do you happen to have an ETA on the fix or know how much more performant it will become once the fix is in place? Other than that all is working great so far and I can't wait to roll out to production as a replacement for the IE browser control!

Thanks!
eo_support
Posted: Saturday, June 14, 2014 10:47:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Quote:
Hi, I've been noticing a severe lag in the initial load as well. Do you happen to have an ETA on the fix or know how much more performant it will become once the fix is in place? Other than that all is working great so far and I can't wait to roll out to production as a replacement for the IE browser control!

Thanks!


Glad to hear that! We do not have a firm date yet but this issue is a high priority for us since it's one of the most noticeable problems. There are a number of optimizations that we are trying to implement on this part. However there is one main advantage IE may still have is that since IE is from MS, very often most of the DLLs that IE uses have already been loaded into memory by the time your application starts, that makes MS's WebBrowser control loads faster.

When comparing with Chrome browser, the cache also plays big role. When you load a page such as Google with Chrome browser, most likely Chrome browser already has the contents in cache thus it can load it very fast. After you have loaded Google with our control and it builds up its cache, it will load the same page very fast too. Nevertheless, the initialization process still takes longer than ideal so that's the part we are working on.

Thanks!

Psych971
Posted: Saturday, June 14, 2014 4:20:05 PM
Rank: Newbie
Groups: Member

Joined: 6/14/2014
Posts: 2
eo_support wrote:

Glad to hear that! We do not have a firm date yet but this issue is a high priority for us since it's one of the most noticeable problems. There are a number of optimizations that we are trying to implement on this part. However there is one main advantage IE may still have is that since IE is from MS, very often most of the DLLs that IE uses have already been loaded into memory by the time your application starts, that makes MS's WebBrowser control loads faster.

When comparing with Chrome browser, the cache also plays big role. When you load a page such as Google with Chrome browser, most likely Chrome browser already has the contents in cache thus it can load it very fast. After you have loaded Google with our control and it builds up its cache, it will load the same page very fast too. Nevertheless, the initialization process still takes longer than ideal so that's the part we are working on.

Thanks!



Thanks for the quick reply!

I haven't tried this myself yet, but do you know if there's an effective way to pre-load browser controls off screen to a given URL? Perhaps create a pool of controls and pop them into my interface when needed? Basically we have several different "results" screens with the results plotted on a web-hosted map, and I need that map to be visible as soon as we switch to the results view. For efficiency, these results views are not initialized until the first time they're loaded, so I'd like to initialize just the browser controls without having to load the entire view in the background.

We're all very eager to scrub the IE scourge from our application so as soon as we can overcome the initial lag problem we'll be very happy campers here Angel

Thanks again!
eo_support
Posted: Saturday, June 14, 2014 4:35:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Currently there is no way to pre-load a browser off screen and then turn it into on-screen. You can try to load a very small browser (for example, a 1 pixel by 1 pixel) as soon as your application starts and then resize it to the desired size when you really need to show them to see if that improves the performance. Please keep in mind that:

1. A WebView instance is always associated to the thread that creates it, so you can not create a WebView in one thread and then use it in another thread. This means that in an UI application, the WebView should always be created in the UI thread. However since most of the initialization work are done in background threads, so it should not have visible impact on your UI thread when you create the WebView instances early;

2. You will also want to set the "mini" WebView's initial Url to a Url from the same domain of the actual Url that you wish to display later. This is because when a WebView switches domains, it needs to redo a lot of initialization work and that takes time as well;

Please let us know if that works for you.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.