This repository has been archived by the owner on May 10, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LocationCompleter] Don't leak when query icons,
- it seems it's a fix for #1299
- Loading branch information
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has nothing to do with mentioned issue. The LocationCompleterRefreshJob runs on a separate thread, so the small performance gain has no impact on user experience at all.
Not to mention, the mentioned issue is for v1.6 branch, which don't have this class.
Also, where is the leak in this code?
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit made my location completer faster 4-5 times, if not even more than that.
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I exaggerated a little bit, but it really is noticeable faster.
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What icons?
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In completer. That's because this commit is just wrong.
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very sorry for any inconvenience.
Some things mislead me about this patch:
QSqlQuery::prepare
in this way withQSqlQuery::bindValue
and it works correctly, because of this when I wrote this patch I didn't test it deeply, after a few hours I found thatQSqlQuery::addBindValue
doesn't work likeQSqlQury::bindValue
and indeed improvement is because of unsuccessful queries. :-DWhat is the problem that I incorrectly try to fix it by this patch?
Loading icons on medium size database is very slow for example
My profile
:I have ~7000 icon records:
A set of queries that has 29 items that 10 of them have icon needs 28 seconds to finish!!!
Fortunately I found the correct solution:
The problem is when a url contains of one or more
%
. Also I added a cache for icons for more speedup.666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would work if you change the
addBindValue
to justbindValue(0, ...)
.To the performance issue, searching in
icons.url
should be fast enough because of index on this column (no matter how much icons you have in database).Edit: Hmm, you are right. It takes a lot of time for a
SELECT * FROM icons WHERE url LIKE %.com%
query ... I wonder why?Edit2: However, I get no performance issues directly in QupZilla (with 5500 icons in db)
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit2: However, I get no performance issues directly in QupZilla (with 5500 icons in db)
Well, query like
... LIKE %.com%
doesn't occur in QupZilla, but complex queries like this one:... LIKE %http://pozh.org/337-%D8%AA%D9%88%D8%B3%D8%B9%D9%87-%D9%BE%D8%A7%DB%8C%DA%AF%D8%A7%D9%87%E2%80%8C%D8%AF%D8%A7%D8%AF%D9%87-%D8%B3%D8%A7%D8%BA%D8%B1/%
that takes a lot of time(indeed I mean hang here for my profile) occurs.Edit: That I fixed it by these lines in above patch:
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that's not a correct fix. It should be escaped (not sure how it's done in sqlite).
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you tell how many icons do you have in db? My database is 21 MB, perhaps it is enough for performance testing?
666ecc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pejakm You can use this query
SELECT count() FROM icons
or use a database browser like this one.