Reduce the frequency of dirty calculations in inlineEditor.

Review Request #6426 — Created Oct. 10, 2014 and submitted

Information

Djblets
master
2685790...

Reviewers

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 than console.time is telling us.)

reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        djblets/static/djblets/js/jquery.gravy.inlineEditor.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        djblets/static/djblets/js/jquery.gravy.inlineEditor.js
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.8.x (44d53f5)