0

initWhenAvailable function uses too much CPU

Hey Folks-

We're testing out the BrowserPlus notifier package which is really slick. One issue we're finding is that the BrowserPlus.initWhenAvailable( callback_ ) function, the CPU is spiking on our test machines. This is most noticeable in IE6, but also seems to use about 30% of the resources in FF.

Something you can look into?

Thanks,
---Marc

by
4 Replies
  • QUOTE (marc2112 @ Dec 2 2008, 09:48 AM) <{POST_SNAPBACK}>
    Hey Folks-

    We're testing out the BrowserPlus notifier package which is really slick. One issue we're finding is that the BrowserPlus.initWhenAvailable( callback_ ) function, the CPU is spiking on our test machines. This is most noticeable in IE6, but also seems to use about 30% of the resources in FF.

    Something you can look into?

    Thanks,
    ---Marc


    Hi Again Mark!

    The full implementation of initWhenAvailable is here: http://bp.yahooapis.com/2.1.11/browserplus.js
    (remove the -min to see unminified code)

    here it is inline:
    CODE
            initWhenAvailable: function(initArgs, callback) {
    setTimeout(function() {
    try { navigator.plugins.refresh(false); } catch(e) { }
    BrowserPlus.init(initArgs, function(r) {
    if (r.success) {
    callback(r);
    } else {
    BrowserPlus.initWhenAvailable(initArgs, callback);
    }
    });
    }, 1000);
    },


    There are a couple ways to mitigate things in the short term:
    1. reduce the poll period (rewrite initWhenAvailable)
    2. ONLY call "initWhenAvailable" once the user has clicked on the upsell link

    The more robust solution would be to dig into the javascript wrapper and figure out lighter weight ways to detect plugin presence. I'll get this on our todo list (which we should make public, btw).

    What are the parameters of your test machine? We'll find a similar box to test on.

    curious to hear more in attempts to mitigate or any feedback you may have on a proper solution :)lloyd
    0
  • Hey Lloyd,

    We ended up overriding the method with an implementation that uses a shorter poll time which seems to help.

    Thanks,
    ---Marc
    0
  • QUOTE (marc2112 @ Dec 2 2008, 03:09 PM) <{POST_SNAPBACK}>
    Hey Lloyd,

    We ended up overriding the method with an implementation that uses a shorter poll time which seems to help.

    Thanks,
    ---Marc


    Yo Marc,

    what poll period did you go with? What are the specifications of an XP box that demonstrates unacceptable cpu usage?

    best,
    lloyd
    0
  • We start out checking every 3s delay (instead of 1s) and back off to checking every 30s if user still hasn't installed after 5 minutes (maybe they switched tasks or something so we'll play nice)

    XP machine is a P4. Don't have the details.
    0
This forum is locked.

Recent Posts

in Support & General Questions