• 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
..
Makefile Loading commit data...
ast.go Loading commit data...
doc.go Loading commit data...
gcc.go Loading commit data...
godefs.go Loading commit data...
main.go Loading commit data...
out.go Loading commit data...
util.go Loading commit data...