vinny75 / blackbirdjs

Blackbird - Open Source JavaScript Logging Utility
0 stars 0 forks source link

performance problem due to #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Produce a lot of messages while the bb window is visible
2. Use the profiler to measure the time used for that work

What is the expected output? What do you see instead?
Really slow due to method scrollToBottom() in firefox 3 (smooth scrolling
used).

What version of the product are you using? On what operating system?
bb 1.0 (windows)

Please provide any additional information below.
Here is a patch and a simple workaround : use a js timer to prepare a
callback (future) to scrollToBottom in 50 milliseconds that is cancel
(delayed in fact) when other messages are produced

=> only 1 scrollToBottom() call after 50ms of inactivity (js is idle)

=> only 5ms on my machine

code :

    var scrollTimer = null;
    var scrollDelay = 50;

    function scrollToBottom() { 
        // reset the current delayed call to doScroll() : 
        if (scrollTimer) {
            clearTimeout(scrollTimer);
            scrollTimer = null;
        }
        // define a delayed call to doScroll() : 
        if (scrollTimer == null) {
            scrollTimer = setTimeout("window['" + NAMESPACE + "'].scroll()",
scrollDelay);
        }
    }

    function doScroll() {
        // scroll list output to the bottom :
        outputList.scrollTop = outputList.scrollHeight;
    }

Note : my file contains other changes :
- disabled cookie (security issues) => default state is ON
- onLoad conflict with other js framework => manual call to start function

        start:
            function() { bbOnLoad(); },
        scroll:
            function() { doScroll(); },
        hide:
            function() { if (isVisible()) { hide(); } },
        show:
            function() { if (!isVisible()) { show(); scrollToBottom(); } },

Original issue reported on code.google.com by bourges....@gmail.com on 15 May 2009 at 4:40

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for identifying this.  I'll definitely add it to the next official 
release.

Original comment by gscottol...@gmail.com on 15 May 2009 at 5:58