• Robert Griesemer's avatar
    go/scanner: 17% faster scanning · 3fc327b3
    Robert Griesemer authored
    - Changed the Scan API semantics slightly:
    The token literal string is only returned
    if the token is a literal, comment, semicolon,
    or illegal character. In all other cases, the
    token literal value is determined by the token
    value.
    
    Clients that care about the token literal value
    when not present can always use the following
    piece of code:
    
    pos, tok, lit := scanner.Scan()
    if lit == "" {
       lit = tok.String()
    }
    
    - Changed token.Lookup API to use a string instead
    of a []byte argument.
    
    - Both these changes were long-standing TODOs.
    
    - Added BenchmarkScan.
    
    This change permits a faster implementation of Scan
    with much fewer string creations:
    
    benchmark                old ns/op    new ns/op    delta
    scanner.BenchmarkScan        74404        61457  -17.40%
    
    R=golang-dev, rsc
    CC=golang-dev
    https://golang.org/cl/5532076
    3fc327b3
Name
Last commit
Last update
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...