Pinned windows and CPU usage

9 posts, 0 answers
  1. KracsNZ
    KracsNZ avatar
    9 posts
    Member since:
    Aug 2008

    Posted 14 Oct 2008 Link to this post

    Have a major problem with RadWindows that are pinned.

    When opening a RadWindow (either clientside or serverside) and pinning it caused the clients CPU usage for iexplore.exe to go up. When the window is not pinned the CPU usage will generally be 0, but as soon as we pin the windows the CPU can increase by as much as 8% and stay there until we unpin it.

    Completely baffled by this behaviour. Just to test it wasn't something I introduced I created a very basic new web application, added simply the scriptmanager, radwindowmanager and 1 radwindow to the page. We added a simple page to load in the radwindow.

    I then pinned the window and the CPU usage went up and stayed up, unpinned it and the CPU usage went down.

    Heres the example we used...
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TestRad._Default" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"  
                OutputCompression="AutoDetect"
            </telerik:RadScriptManager> 
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
                <Windows> 
                    <telerik:RadWindow runat="server" VisibleOnPageLoad="true" Visible="true" Behavior="Maximize, Minimize, Pin" InitialBehavior="Pin" NavigateUrl="WebForm1.aspx"></telerik:RadWindow> 
                </Windows> 
            </telerik:RadWindowManager> 
        </div> 
        </form> 
    </body> 
    </html> 
     

    ...and the window to load...
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="TestRad.WebForm1" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
        hello world 
        </div> 
        </form> 
    </body> 
    </html> 
     

    No code behind is on either form. Absolutely annoying.

    We did some snooping and located a possible area where the issue is happening. Seems to be getting stuck in one of the telerik script resource files. We notice ValidateParameter was being called constantly after the pinning though we didn't have the time to debug fully.


  2. KracsNZ
    KracsNZ avatar
    9 posts
    Member since:
    Aug 2008

    Posted 14 Oct 2008 Link to this post

    I've added a snippet from the resource file below...
    Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) { 
        var e; 
        var expectedType = expectedParam.type; 
        var expectedInteger = !!expectedParam.integer; 
        var expectedDomElement = !!expectedParam.domElement; 
        var mayBeNull = !!expectedParam.mayBeNull; 
        e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName); 
        if (e) { 
            e.popStackFrame(); 
            return e; 
        } 
        var expectedElementType = expectedParam.elementType; 
        var elementMayBeNull = !!expectedParam.elementMayBeNull; 
        if (expectedType === Array && typeof(param) !== "undefined" && param !== null && 
            (expectedElementType || !elementMayBeNull)) { 
            var expectedElementInteger = !!expectedParam.elementInteger; 
            var expectedElementDomElement = !!expectedParam.elementDomElement; 
            for (var i=0; i < param.length; i++) { 
                var elem = param[i]; 
                e = Function._validateParameterType(elem, expectedElementType, 
                    expectedElementInteger, expectedElementDomElement, elementMayBeNull, 
                    paramName + "[" + i + "]"); 
                if (e) { 
                    e.popStackFrame(); 
                    return e; 
                } 
            } 
        } 
        return null

    If I set a breakpoint early in the function above, and F5 everytime the break point gets hit, after about 5 times the breakpoint doesn't get hit again and the CPU usage returns to normal. Clear the breakpoint and whalla, the CPU usage stays high again.


  3. KracsNZ
    KracsNZ avatar
    9 posts
    Member since:
    Aug 2008

    Posted 15 Oct 2008 Link to this post

    Just to qualify this, its happening on both IE7 and Firefox 3. Happening using the latest downloadable build of RadTools and is happening on both my Laptop and Desktop dev machines.

    Versions of RadTools tested:
    2008.2 723
    2008.2 1001

    Both exhibit the same problem.
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 16 Oct 2008 Link to this post

    Hi Mark,

    The code that you posted is not from RadWindow's code but from the ASP.NET AJAX framework. I believe that the problem that you experience is due to the enabled compilation debug mode in your web.config file.

    When compilation debug is set to "true", the MS AJAX framework outputs a lot of client debugging code that severely degrade the performance. That is why we strongly recommend to turn it off - this should fix the problem with the CPU usage in this scenario.



    Greetings,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. KracsNZ
    KracsNZ avatar
    9 posts
    Member since:
    Aug 2008

    Posted 16 Oct 2008 Link to this post

    Hi, thanks for the reply. That suggestion doesn't really help. After setting debug to false, all it does is lower the constant CPU usage a bit, but its still there, and is only happening to pinned windows. Unpinning the windows stops the constant CPU usage.
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 17 Oct 2008 Link to this post

    Hi Mark,

    I just answered your support ticket on the same subject. For convenience I am pasting my reply below:

    Currently we are using JavaScript to keep the window pinned - this was needed because it is the only way to keep the window fixed in IE6. The JavaScript code checks on small intervals if the window is still in the same place and that is why CPU usage increases.

    Because currently all major browsers like IE7 and Firefox support position:fixed, we will change the logic of the control so it uses the new CSS approach and fix the window with JavaScript only in IE6 - this will lower the CPU usage as well. The change however will take some time as we have to make sure that it will work flawlessly in all scenarios and we will not be able to fix this for the Q3 release in the beginning of the next month. I can assure you however that we will implement it in a following update.




    Best wishes,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. KracsNZ
    KracsNZ avatar
    9 posts
    Member since:
    Aug 2008

    Posted 19 Oct 2008 Link to this post

    Cheers, thanks for the reply, and looking forward to the update :)
  8. Matthew Botting
    Matthew Botting avatar
    41 posts
    Member since:
    Apr 2005

    Posted 08 Jul 2012 Link to this post

    I do realise that this is a rather old thread but has this been fixed?
    On my machine IE 9's CPU usage will jump from 0 to 10% when I pin a radWindow.
    I am using the current version 2012.2.607.40

    To make matters worse I have a particular case where each time the window's position is updated it will cause a line of text to wrap. The following time it is updated it unwraps. The end result is that the window is continually flickering as the text moves around.
  9. Slav
    Admin
    Slav avatar
    1359 posts

    Posted 11 Jul 2012 Link to this post

    Hello Matthew,

    The problem with the CPU usage level has been fixed. As explained earlier in the thread, the logic for pinning the RadWindow control now uses the CSS style position:fixed as all major browsers support this approach. The slight increase in the CPU usage that you encountered is not related to the behavior discussed in this thread. Nevertheless, we will take this scenario in account , although I cannot provide a firm estimate when it will be inspected as there are tasks with higher priority in our To Do list.

    The issue with the wrapped text could be related with the positioning of the RadWindow's content. I am willing to help you, but I will need more information on your setup as I am not aware of such a scenario and I am mostly guessing as to what your configuration is.

    Greetings,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top