I’m trying to place a user control inside an UpdatePanel.
When the control is displayed, typing inside the TextBoxes has a large delay while in IE (6 & 8). FireFox has an excellent performance. Not only typing, but also scrolling etc experience a large delay up to a few seconds.
The usercontrol(s) contain quite a lot of javascript functions that are re-registered using the ScriptManager.RegisterScriptBlock or RegisterStartupScript functions.
Has anyone any ideas why typing becomes so very slow? I believe it has to do something with memory leaking due to the re-registration of the jQuery functions. But I’m unable to find the source of it.
Regards
JavaScript written by yourself or others or part of a reliable framework?
Generic tips:
– reduce processes and function calls
– delegate events
– cache and reuse jQuery results (especially for IE) and only requery when you know the DOM changed.
– avoid recursion unless you know how to avoid all memory leak prone practises.
– Concerning form inputs, use ‘focus’ and ‘blur’ events rather then ‘keypress’ wherever you can.
– When using ‘keypress’ events, debounce, debounce, debounce! (google it)
Use:
– Firebug profiler to see which functions are called and how many times, this shows you what you need to reduce.