Answered by:
BHO Load Time in IE9 - Dll loaded in Cache?

Question
-
Hi,
I've developped a BHO/ IE extension working on IE7, IE8 and IE9 for Windows XP, Vista and 7. I began to create the BHO from this excellent article in CodeProject . Since then, I've developped a lot of new functionalities and everything's working great.
Though, in IE9, the load time is highly random. It's a problem since IE9 shows a window to disable slow extensions if it's over 200ms by default (and I don't want the users to disable mine because of this!).
I ran some tests and saw that the load time is decreasing every time I launch IE9 with the extension enabled. Most of the time the load time for my BHO is under 100ms, but sometimes (mostly at first install), it's over 200ms and will appear red in IE popup to disable extensions. I did care to create the BHO the best way possible and not to slow user experience. The DLLGetClassObject doesn't contain more code than there initially was in the CodeProject code : I moved everything to take action later, when pages are loaded for exemple.
Is this happening because IE9 is storing my DLL in cache somewhere to launch it faster after some time? Is there a way to preload the BHO like this, or to enhance the code to decrease load time?
Thank you!
Valentin
Friday, February 4, 2011 11:19 AM
Answers
-
There is no way to preload.
You should read these articles from the IE blog:
- http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx
- http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx
- http://blogs.msdn.com/b/ie/archive/2010/09/12/add-ons-measuring-performance.aspx
Then go have a look at what you're doing in your IObjectWithSite::SetSite() implementation, as well as various navigation event sinks. Ask yourself: Is this expensive? Does it do disk access? Does it load DLLs? Does it make synchronous network requests?
If you answer yes, try to find ways to do those things asynchronously on a background thread.- Marked as answer by Yi Feng Li Tuesday, February 15, 2011 2:28 AM
Friday, February 4, 2011 10:51 PM
All replies
-
There is no way to preload.
You should read these articles from the IE blog:
- http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx
- http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx
- http://blogs.msdn.com/b/ie/archive/2010/09/12/add-ons-measuring-performance.aspx
Then go have a look at what you're doing in your IObjectWithSite::SetSite() implementation, as well as various navigation event sinks. Ask yourself: Is this expensive? Does it do disk access? Does it load DLLs? Does it make synchronous network requests?
If you answer yes, try to find ways to do those things asynchronously on a background thread.- Marked as answer by Yi Feng Li Tuesday, February 15, 2011 2:28 AM
Friday, February 4, 2011 10:51 PM -
There is no way to preload.
You should read these articles from the IE blog:
- http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx
- http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx
- http://blogs.msdn.com/b/ie/archive/2010/09/12/add-ons-measuring-performance.aspx
Then go have a look at what you're doing in your IObjectWithSite::SetSite() implementation, as well as various navigation event sinks. Ask yourself: Is this expensive? Does it do disk access? Does it load DLLs? Does it make synchronous network requests?If you answer yes, try to find ways to do those things asynchronously on a background thread.I've read the articles and follow it in my add on. But when first start IE9 on system restart, the load time of my add on always costs about 250ms. I use windows performance tools and see: it costs 200ms between ExtensionCreate start/stop, and only 50ms between ExtensionSetSite start/stop.
In my add-on DLLGetClassObject() just do necessary work and return as soon as possible. I use OutputDebugString also see that.
So, my question is, how to optimizing the load time between ExtensionCreate start/stop?
Thursday, April 7, 2011 7:25 AM -
There is no way to preload.
You should read these articles from the IE blog:
- http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx
- http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx
- http://blogs.msdn.com/b/ie/archive/2010/09/12/add-ons-measuring-performance.aspx
Then go have a look at what you're doing in your IObjectWithSite::SetSite() implementation, as well as various navigation event sinks. Ask yourself: Is this expensive? Does it do disk access? Does it load DLLs? Does it make synchronous network requests?If you answer yes, try to find ways to do those things asynchronously on a background thread.I've read the articles and follow it in my add on. But when first start IE9 on system restart, the load time of my add on always costs about 250ms. I use windows performance tools and see: it costs 200ms between ExtensionCreate start/stop, and only 50ms between ExtensionSetSite start/stop.
In my add-on DLLGetClassObject() just do necessary work and return as soon as possible. I use OutputDebugString also see that.
So, my question is, how to optimizing the load time between ExtensionCreate start/stop?
I have the same problem. Even I've removed all routines in SetSite() of BHO add-on, sometimes it still costs time more than 200ms, especially at first start IE after system restart.
My question is that are there any other specific factors of IE/system which will affect load time?, not just SetSite() or routines in BHO.
Thanks!
Wednesday, April 13, 2011 6:12 AM -
I am starting to suspect that 200ms is pretty much the minimum it takes for a C# BHO even if you have no code at all.
I might try rewriting this in C++...
Thursday, April 19, 2012 7:43 PM -
It's not the DLL cache that's doing this. Well it is involved in making your BHO run faster the second run.
It seems like IE is showing us an average load time. It keeps a counter of how many times the extension is started and what was the last load time. Based on that it just computes an averages. So keep in mind that if you've debugged your extension and the LoadTime got up to 10s then it will take about a 100 runs of IE before the average load time of your extension is down to a reasonable value again.
Check out this key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Stats\{YOUR-BHO-GUID-HERE}\iexplore
It contains a Count and LoadTime DWORDs. Reset both to zero and you'll reset the averages manually.
Good Luck in performance tuning your extensions. At least now you know your real Load Times.
- Edited by Veselin Kulov Friday, September 27, 2013 10:39 AM
Friday, September 27, 2013 10:38 AM