title: Why would Chrome take 12 seconds to do an Update Layer Tree?
body: <p>I have a relatively un-complex ASP.Net application, which occasionally displays an alert message in layer, with a shadow, with a pushbutton to dismiss the notification.</p>
  
  <p>This code has been working fine for years.</p>
  
  <p>Lately, I am getting complaints from users of really slow response.  What they experience is that the page is completely unresponsive, and when they click on the [OK] pushbutton nothing happens for a really long time.</p>
  
  <p>When I record a Timeline, I can see the original even which caused a round-trip to the webserver, and I can see the response from the webserver.  I can also see all the Javascript code which runs as a result of the response.</p>
  
  <p>As far as the application is concerned, the transaction is over, and, as far as the Javascript is concerned, the transaction is over as well.  All we need to do is wait for the user to click the [OK] button and we will dismiss the notification popup.</p>
  
  <p>This is where the "freeze" happens.  The [OK] event is not delivered for like 20-30 seconds.  What's going on in the meantime?  That's why I'm writing:</p>
  
  <p>We see some very short timers fire every once in a while, then we see a quick Recalculate Style call, followed by an Update Layer Tree event.</p>
  
  <p>The Update Layer Tree event takes 10-12 seconds!</p>
  
  <p><img src="https://i.stack.imgur.com/TwF6t.png" alt="The Update Layer Tree event takes 10-12 seconds (not milliseconds)"></p>
  
  <p>Here's the code for the dialog which is going unresponsive because of the Update Layer Tree events  The  gets displayed first as you see it here, then, if something goes wrong, it may get updated with code similar to showAlert:</p>
  
  <p><a href="https://i.stack.imgur.com/Cr6gm.png" rel="noreferrer">Status/error dialog code</a></p>