Reduce the frequency of dirty calculations in inlineEditor.
Review Request #6426 — Created Oct. 10, 2014 and submitted — Latest diff uploaded
inlineEditor no longer calculates the dirty state on every single key
press. Instead, it calculates it at most once every 200ms. This helps to
improve performance when the text field is large.When it does calculate, the default behavior is now to first compare the
lengths of the strings. If those differ, then there's no need to compare
the string contents.
Tested this along with some other changes. The performance felt a lot nicer.
console.time
says that the calculations only took about 0.01ms on average
for a medium-sized text field. However, along with other operations that may be
performed based on changes, and the draw times needed for the text display (when
using CodeMirror), this does appear to contribute to a noticeable difference.(The defer may be a large part of it, but the throttling seems to help... I'm
guessing more is going on thanconsole.time
is telling us.)