forked from mirror/oddmu
Compare commits
1 Commits
trigram-se
...
timing
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8429f58ef |
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"time"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
@@ -71,9 +72,15 @@ func search(q string) []Page {
|
||||
if len(q) == 0 {
|
||||
return make([]Page, 0)
|
||||
}
|
||||
start := time.Now()
|
||||
names := searchDocuments(q)
|
||||
fmt.Printf("Search for %v found %d pages in %v\n", q, len(names), time.Since(start))
|
||||
start = time.Now()
|
||||
items := loadAndSummarize(names, q)
|
||||
fmt.Printf("Loading and summarizing %d pages took %v\n", len(names), time.Since(start))
|
||||
start = time.Now()
|
||||
slices.SortFunc(items, sortItems)
|
||||
fmt.Printf("Sorting %d pages took %v\n", len(names), time.Since(start))
|
||||
return items
|
||||
}
|
||||
|
||||
|
||||
4
wiki.go
4
wiki.go
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Templates are parsed at startup.
|
||||
@@ -67,9 +68,10 @@ func getPort() string {
|
||||
// messages.
|
||||
func scheduleLoadIndex() {
|
||||
fmt.Print("Indexing pages\n")
|
||||
start := time.Now()
|
||||
n, err := index.load()
|
||||
if err == nil {
|
||||
fmt.Printf("Indexed %d pages\n", n)
|
||||
fmt.Printf("Indexed %d pages in %v\n", n, time.Since(start))
|
||||
} else {
|
||||
fmt.Println("Indexing failed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user