Only check parser position update if a cell or row is complete
This commit is contained in:
parent
413c17eb94
commit
16dd5b5dc1
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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) }
|
||||
|
|
Loading…
Reference in New Issue