What happens between "End PreRenderComplete" and "Begin SaveState"

Last post 06-04-2009 3:20 PM by treyg. 13 replies.

Sort Posts:

  • What happens between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 6:19 AM
    • Member
      point Member
    • mare
    • Member since 10-04-2008, 4:25 PM
    • Posts 8

    Hello everybody,

    I have weird ~150ms delay between End PreRenderComplete and Begin SaveState which I can't debug or fix. What exactly happens between these events ?

    End PreRender 0.0465466979741839 0.000631
    Begin PreRenderComplete 0.0465832948042279 0.000037
    End PreRenderComplete 0.0466746471967806 0.000091
    Begin SaveState 0.19632439318405 0.149650
    End SaveState 0.198695085548582 0.002371

    Thanks!

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 6:50 AM
    • All-Star
      17,451 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,186

    check Page life cycle 

     http://msdn.microsoft.com/en-us/library/aa719775(VS.71).aspx

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 7:11 AM
    • Star
      9,788 point Star
    • shashankgwl
    • Member since 09-19-2008, 3:18 PM
    • MUMBAI
    • Posts 1,931

    Begin SaveState is the subroutine for saving the viewstate, so the bigger the page is , the greater the time duration will be. that's perfectly ok i think.

    SHASHANK BHIDE
    CAPGEMINI INDIA
    "THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT Wink "
  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 7:33 AM
    • Member
      point Member
    • mare
    • Member since 10-04-2008, 4:25 PM
    • Posts 8

    Hey there.

    It's not the SaveViewState that bothers me, but rather the time between those two events. If you look closely, the time that bothers me is the time between After End PreRenderComplete and before Begin SaveState, where none of the events fired.

    Marko

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 7:56 AM
    • All-Star
      17,451 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,186

    if you know how stack is worked then you got what you need.

    All the addresses are stored in Stack,

    There fore if next Event is Pre_Render  then he store address last line which is

    executing then transfer the Execution to  Pre_Render.

    if Pre_Render end then it again move the Pointer which is last time save.

    There fore it must take time for these steps also 

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 8:05 AM
    • Star
      9,788 point Star
    • shashankgwl
    • Member since 09-19-2008, 3:18 PM
    • MUMBAI
    • Posts 1,931

    imran_ku07:

    if you know how stack is worked then you got what you need.

    All the addresses are stored in Stack,

    There fore if next Event is Pre_Render  then he store address last line which is

    executing then transfer the Execution to  Pre_Render.

    if Pre_Render end then it again move the Pointer which is last time save.

    There fore it must take time for these steps also 

     

    Stack Switch is not that much time taking , and the time required to fetch the next instruction from SS:SP is generally uniform across the x86 machines.

    SHASHANK BHIDE
    CAPGEMINI INDIA
    "THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT Wink "
  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 8:07 AM
    • Star
      9,788 point Star
    • shashankgwl
    • Member since 09-19-2008, 3:18 PM
    • MUMBAI
    • Posts 1,931

    there is some performance issue, which has been highlighted by others also.

    http://forums.asp.net/p/1207740/2121635.aspx#2121635

    http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=Begin+SaveState&btnG=Search&meta=&aq=f&oq=

     

    SHASHANK BHIDE
    CAPGEMINI INDIA
    "THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT Wink "
  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 8:14 AM
    • All-Star
      17,451 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,186

    shashankgwl:
    Stack Switch is not that much time taking , and the time required to fetch the next instruction from SS:SP is generally uniform across the x86 machines.
     

    Then what is else there that takes time?

    As I Know  Garbage Collector Start to De Allocate Objects from Heap and move the Free Memory to Downward also takes some time But it is perform after  Unload Event

     

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 8:20 AM
    • Member
      point Member
    • mare
    • Member since 10-04-2008, 4:25 PM
    • Posts 8

    imran_ku07:

    if you know how stack is worked then you got what you need.
    All the addresses are stored in Stack,
    There fore if next Event is Pre_Render  then he store address last line which is
    executing then transfer the Execution to  Pre_Render.
    if Pre_Render end then it again move the Pointer which is last time save.
    There fore it must take time for these steps also 

    Hi, I'm familiar with stack but I don't understand exactly what you mean by this. If I look closely to these lines..

    End PreRenderComplete 0.0466746471967806 0.000091
    Begin SaveState 0.19632439318405 0.149650
    End SaveState 0.198695085548582 0.002371

    You see that PreRenderComplete finished in 0.000091s, .. and then for some reason 0.149650s later SaveState started (this is the gap I'm interested in to minimize), which took 0.002371s.

    Marko

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 8:31 AM
    • Star
      9,788 point Star
    • shashankgwl
    • Member since 09-19-2008, 3:18 PM
    • MUMBAI
    • Posts 1,931

    network latency might be one of the problems, just do some trial and error by disabling the viewstates of controls and try to find out which action affects the time.

    SHASHANK BHIDE
    CAPGEMINI INDIA
    "THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT Wink "
  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 8:37 AM
    • All-Star
      17,451 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,186

     

    mare:
    Hi, I'm familiar with stack but I don't understand exactly what you mean by this

    if you are familar then you must know that before going to next method
    we have to save it's address and then  restore the stack value.

    But I think also this will not take long to do this.

     

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-06-2009, 9:15 AM
    • Member
      point Member
    • mare
    • Member since 10-04-2008, 4:25 PM
    • Posts 8

    shashankgwl:

    network latency might be one of the problems, just do some trial and error by disabling the viewstates of controls and try to find out which action affects the time.

    I tried to disable complete ViewState (EnableViewState="false") in Page directive, but it's still the same.

     

    Marko

     

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    04-07-2009, 3:10 AM
    Answer
    • All-Star
      17,451 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 1:21 PM
    • KARACHI, PAKISTAN
    • Posts 3,186

    I don't think you can minimize this time.

    Because Between these Events ASP.NET may Perform lot of task
    which are made Hidden.
    I simply mean that it may use High Level of Abstraction


    Also I think your Performance automatically increase if you Disable Tracing.
    Because thers is also lot of overhead of Tracing.

  • Re: What happends between "End PreRenderComplete" and "Begin SaveState"

    06-04-2009, 3:20 PM
    • Member
      2 point Member
    • treyg
    • Member since 06-04-2009, 3:13 PM
    • Posts 1

    From looking at the ProcessRequestMain(bool,bool) method on the Page class in Reflector, it looks like BuildPageProfileTree is called between "End PreRenderComplete" and "Begin SaveState", but only if tracing is enabled.  Looks like the delay you are seeing is the overhead associated with building the trace output.  From Reflector:

                    if (context.TraceIsEnabled)
                    {
                        this.Trace.Write("aspx.page", "End PreRenderComplete");
                    }
                    if (context.TraceIsEnabled)
                    {
                        this.BuildPageProfileTree(this.EnableViewState);
                        this.Trace.Write("aspx.page", "Begin SaveState");
                    }

     
Page 1 of 1 (14 items)
Microsoft Communities