Optimize LanguageController's MimeTypeCache

Previously the filename of each URL argument to
LanguageController::languagesForUrl() was matched against all cached
glob pattern suffixes (sometimes not "all" as suffixes of an already
matched/added language were skipped). Now the filename is only matched
against the suffixes that end with the same case-insensitive character.
This change should improve the performance of this frequently called
function, because case-insensitive string comparison looks like the most
expensive among the actually performed in practice operations in cases
when the language is found in mimeTypeCache.

Suffix matching performance could be further improved by storing reverse
suffixes in a trie (aka prefix tree). However I could not find a
suitable trie implementation in KDevelop or one of its dependencies.
QmlJS::PersistentTrie seems to be the closest match, but it has many
unneeded features and stores only strings with no ability to attach
user data to them (such as ILanguageSupport*). Implementing a trie data
structure specifically for this optimization would be an overkill.

There is currently no need to optimize exact name matching, because
there is only one supported exact name glob pattern: "CMakeLists.txt".
If more exact name glob patterns appear in the future, the elements of
MimeTypeCache::m_exactNames can be easily lower-cased and sorted to
speed up matching against them.
1 job for !151 with fix-and-optimize-languagecontroller-mimetypecache in 60 minutes and 1 second (queued for 74 minutes and 33 seconds)
latest detached
Status Job ID Name Coverage
failed #60608
linux kf5-qt5 qt5.12


Name Stage Failure
linux kf5-qt5 qt5.12 Build The script exceeded the maximum execution time set for the job
[ 84%] Building CXX object kdevplatform/language/codegen/tests/CMakeFiles/test_documentchangeset.dir/test_documentchangeset.cpp.o
[ 84%] Linking CXX executable ../../../../bin/test_documentchangeset
[ 84%] Built target test_documentchangeset
Scanning dependencies of target test_checkerstatus
[ 84%] Building CXX object kdevplatform/shell/tests/CMakeFiles/test_checkerstatus.dir/test_checkerstatus_autogen/mocs_compilation.cpp.o
[ 84%] Building CXX object kdevplatform/shell/tests/CMakeFiles/test_checkerstatus.dir/test_checkerstatus.cpp.o
Uploading artifacts for failed job
Pulling docker image gitlab/gitlab-runner-helper:x86_64-353dd94e ...
ERROR: Job failed: execution took longer than 1h0m0s seconds