Open
      
        Bug 1398572
      
      
        Opened 8 years ago
          Updated 3 years ago
      
        
    
  
Setting input.value is rather string-usage heavy 
    Categories
(Core :: DOM: Editor, enhancement, P3)
        Core
          
        
        
      
        
    
        DOM: Editor
          
        
        
      
        
    Tracking
()
        NEW
        
        
    
  
People
(Reporter: smaug, Unassigned)
References
(Blocks 1 open bug)
Details
When setting input.value we seem to copy string to local nsAutoStrings and what not. That is showing up badly in the profiles.
Maybe we could try to avoid that, at least in common cases.
I tried to do that in nsTextEditorState::SetValue() like:
nsAString* currentValue = aOldValue;
nsAutoString currentValueBuf;
if (!aOldValue) {
  mBoundFrame->GetText(currentValueBuf);
  currentValue = ¤tValueBuf;
}
However, it was slower than without this kind of hack with VC. I guess that VC optimizes something even with current code but my experimental patch killed the optimization.
So, be careful about the result.
| Updated•8 years ago
           | 
Priority: -- → P3
| Reporter | ||
| Comment 2•7 years ago
           | ||
This is still showing up in the profiles. I couldn't immediately see how to improve the situation, but I would expect that we should be able to reuse heap allocated strings usually.
After fixing bug 1588745, TextControlState (previously called nsTextEditorState) uses nsString for new value (setting value). I think that we should create comparing method with current value instead of getting (copying) current value for the comparison.
Depends on: 1588745
Blocks: 1720061
| Updated•3 years ago
           | 
Severity: normal → S3
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•