Development

Changeset 20887

You must first sign up to be able to contribute.

Changeset 20887

Show
Ignore:
Timestamp:
08/07/09 15:33:28 (4 years ago)
Author:
FabianLange
Message:

[yaml] small performance improvement in comment line checking by not using strpos

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • components/yaml/trunk/lib/sfYamlParser.php

    r18297 r20887  
    509509  protected function isCurrentLineComment() 
    510510  { 
    511     return 0 === strpos(ltrim($this->currentLine, ' '), '#'); 
     511    //checking explicitly the first char of the trim is faster than loops or strpos 
     512    $ltrimmedLine = ltrim($this->currentLine, ' '); 
     513    return $ltrimmedLine[0] === '#'; 
    512514  } 
    513515