Help optimizing a function to count the rows in a textarea
What kind of performance are you getting?  Is it acceptable.  If it's not, then I'd look for changing your algorithm, and not minor tweaks.  In particular, I'd look into NOT splitting the string and recalclating each time.  Instead keep track of the state (what line and the number of characters on that line, whether it's a paste or a delete), and do the right thing based upon that.  Adding an additional character at the end of a 5k block of text, adds one more line at most, if the last line was 1 character long, then unless the key being pressed is the enter key, it doesn't even do that.  

But before doing anything, sit down and see how well your existing function works, for your typcial data, and then for some extreme data.