Faster Query comparison.

Changed the return value of some functions to a reference. All these
functions return the contents of members, i.e. addresses on the heap.
Faster cacheKey
Don't use QRegExp if we can have a built-in function