Add debug timings for SQL

This commit is contained in:
Florian Bruhin 2017-06-07 16:37:52 +02:00 committed by Ryan Roden-Corrent
parent 57d96a4512
commit 6ce52f39ae
2 changed files with 7 additions and 2 deletions

View File

@ -22,6 +22,8 @@
from PyQt5.QtWebKit import QWebHistoryInterface
from qutebrowser.utils import debug
class WebHistoryInterface(QWebHistoryInterface):
@ -48,7 +50,8 @@ class WebHistoryInterface(QWebHistoryInterface):
Return:
True if the url is in the history, False otherwise.
"""
return url_string in self._history
with debug.log_time('sql', 'historyContains'):
return url_string in self._history
def init(history):

View File

@ -24,6 +24,7 @@ import re
from PyQt5.QtSql import QSqlQueryModel
from qutebrowser.misc import sql
from qutebrowser.utils import debug
class SqlCategory(QSqlQueryModel):
@ -81,5 +82,6 @@ class SqlCategory(QSqlQueryModel):
# treat spaces as wildcards to match any of the typed words
pattern = re.sub(r' +', '%', pattern)
pattern = '%{}%'.format(pattern)
self._query.run([pattern] * self._param_count)
with debug.log_time('sql', 'Running completion query'):
self._query.run([pattern] * self._param_count)
self.setQuery(self._query)