Improve TotalWords counter func

It is obviously more efficient when we do not care about the actual words.

```
BenchmarkTotalWords-4            100000         18795 ns/op           0 B/op           0 allocs/op
BenchmarkTotalWordsOld-4          30000         46751 ns/op        6400 B/op           1 allocs/op
```
This commit is contained in:
Bjørn Erik Pedersen
2016-08-17 06:37:19 +02:00
parent bcd434794a
commit 4abaec5c04
3 changed files with 56 additions and 10 deletions

View File

@@ -486,10 +486,6 @@ func (p *Page) ReadFrom(buf io.Reader) (int64, error) {
}
func (p *Page) analyzePage() {
// TODO(bep)
if true {
return
}
if p.isCJKLanguage {
p.WordCount = 0
for _, word := range p.PlainWords() {