Skip to content

Commit

Permalink
use range {string} instead of viml_split({string}, "\\zs")
Browse files Browse the repository at this point in the history
benchmark                            old ns/op     new ns/op     delta
BenchmarkVimLParser_VimLParser-4     248887206     235228838     -5.49%
  • Loading branch information
haya14busa committed Sep 14, 2016
1 parent 331a0fe commit 71f910d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,17 @@ func (self *StringReader) __init__(lines []string) {
var lnum = 0
for lnum < len(lines) {
var col = 0
for _, c := range viml_split(lines[lnum], "\\zs") {
for _, r := range lines[lnum] {
c := string(r)
self.buf = append(self.buf, c)
self.pos = append(self.pos, pos{lnum: lnum + 1, col: col + 1})
col += len(c)
}
for lnum+1 < len(lines) && viml_eqregh(lines[lnum+1], "^\\s*\\\\") {
var skip = true
col = 0
for _, c := range viml_split(lines[lnum+1], "\\zs") {
for _, r := range lines[lnum+1] {
c := string(r)
if skip {
if c == "\\" {
skip = false
Expand Down

0 comments on commit 71f910d

Please sign in to comment.