Skip to content

Commit

Permalink
speed-up the search a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mandrigin committed Apr 22, 2020
1 parent 8763eb4 commit cfff58a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 0 additions & 4 deletions EnumWindows/BrowserApplication.swift
Expand Up @@ -54,10 +54,6 @@ class BrowserTab : BrowserNamedEntity, Searchable, ProcessNameProtocol {
}

var title : String {
return self.titleInternal.count > 0 ? self.titleInternal : self.url
}

var titleInternal : String {
/* Safari uses 'name' as the tab title, while most of the browsers have 'title' there */
if self.rawItem.responds(to: Selector("name")) {
return performSelectorByName(name: "name", defaultValue: "")
Expand Down
15 changes: 15 additions & 0 deletions EnumWindows/main.swift
Expand Up @@ -62,6 +62,21 @@ func handleCatalinaScreenRecordingPermission() {

handleCatalinaScreenRecordingPermission()

/*
a naive perf test, decided to keep it here for convenience
let start = DispatchTime.now() // <<<<<<<<<< Start time
for _ in 0...100 {
search(query: "pull", onlyTabs: false)
}
let end = DispatchTime.now() // <<<<<<<<<< end time
let nanoTime = end.uptimeNanoseconds - start.uptimeNanoseconds // <<<<< Difference in nano seconds (UInt64)
let timeInterval = Double(nanoTime) / 1_000_000_000 // Technically could overflow for long running tests
print("TIME SPENT: \(timeInterval)")
*/

for command in CommandLine.commands() {
switch command {
case let searchCommand as SearchCommand:
Expand Down

0 comments on commit cfff58a

Please sign in to comment.