Only check parser position update if a cell or row is complete

This commit is contained in:
Caleb Kleveter 2019-04-19 10:02:46 -05:00
parent 413c17eb94
commit 16dd5b5dc1
No known key found for this signature in database
GPG Key ID: B38DBD5CF2C98D69
2 changed files with 3 additions and 2 deletions

View File

@ -153,13 +153,14 @@ public struct Parser {
catch let error { errors.errors.append(error) }
self.state.headerIndex += 1
}
currentCell = []
slice = (index + 1, index + 1)
if updateState { self.state.position = .cells }
}
default: slice.end += 1
}
if updateState { self.state.position = .cells }
index += 1
}

View File

@ -102,7 +102,7 @@ final class ParserTests: XCTestCase {
let chnks = chunks.map { Array($0.utf8) }
let length = chnks.reduce(0) { $0 + $1.count }
// 1.215
// 1.198
measure {
for _ in 0..<100_000 {
chnks.forEach { chunk in parser.parse(chunk, length: length) }