summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAndreas Kling <andreas.kling@nokia.com>2011-03-15 13:20:03 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2011-03-15 15:50:20 (GMT)
commit3a2bb048b49e8d009d785ddd4c0ed221766cc11e (patch)
tree1a568abade12d49a6845cb48696184f6e5b40564 /qmake
parent32d872a3456ecd7cb8c0f0437a7301e1c476bbd3 (diff)
downloadQt-3a2bb048b49e8d009d785ddd4c0ed221766cc11e.zip
Qt-3a2bb048b49e8d009d785ddd4c0ed221766cc11e.tar.gz
Qt-3a2bb048b49e8d009d785ddd4c0ed221766cc11e.tar.bz2
Don't cache resolved paths in MakefileGenerator::fileFixify().
The cache ends up dog-slow because of poor distribution in hashing of QStrings, and even with a better hashing function, computing the result on the fly is still faster. Tested with WebCore.pro, on Linux processing time goes from 58 to 8 seconds, and on Windows from 105 to 65 seconds. Reviewed-by: Marius Storm-Olsen
Diffstat (limited to 'qmake')
-rw-r--r--qmake/cachekeys.h48
-rw-r--r--qmake/generators/makefile.cpp12
2 files changed, 0 insertions, 60 deletions
diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h
index 2957d61..b29e4f2 100644
--- a/qmake/cachekeys.h
+++ b/qmake/cachekeys.h
@@ -118,54 +118,6 @@ struct FileInfoCacheKey
inline uint qHash(const FileInfoCacheKey &f) { return f.hashCode(); }
// -------------------------------------------------------------------------------------------------
-struct FileFixifyCacheKey
-{
- mutable uint hash;
- QString in_d, out_d;
- QString file, pwd;
- uint fixType;
- bool canonicalize;
- FileFixifyCacheKey(const QString &f, const QString &od, const QString &id,
- uint ft, bool c)
- {
- hash = 0;
- pwd = qmake_getpwd();
- file = f;
- if(od.isNull())
- out_d = Option::output_dir;
- else
- out_d = od;
- if(id.isNull())
- in_d = qmake_getpwd();
- else
- in_d = id;
- fixType = ft;
- canonicalize = c;
- }
- QString toString() const {
- return file + "--" + in_d + "--" + out_d + "--" + pwd + "--" +
- QString::number(fixType) + "--" + QString::number((int)canonicalize);
- }
- bool operator==(const FileFixifyCacheKey &f) const
- {
- return (f.canonicalize == canonicalize &&
- f.fixType == fixType &&
- f.file == file &&
- f.in_d == in_d &&
- f.out_d == out_d &&
- f.pwd == pwd);
- }
- inline uint hashCode() const {
- if(!hash)
- hash = uint(canonicalize) | uint(fixType) |
- qHash(file) | qHash(in_d) | qHash(out_d) /*|qHash(pwd)*/;
- return hash;
- }
-};
-
-inline uint qHash(const FileFixifyCacheKey &f) { return f.hashCode(); }
-// -------------------------------------------------------------------------------------------------
-
template <typename T>
inline void qmakeDeleteCacheClear(void *i) { delete reinterpret_cast<T*>(i); }
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 595768f..7963976 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2813,17 +2813,6 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
return file;
QString ret = unescapeFilePath(file);
- //setup the cache
- static QHash<FileFixifyCacheKey, QString> *cache = 0;
- if(!cache) {
- cache = new QHash<FileFixifyCacheKey, QString>;
- qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FileFixifyCacheKey, QString> >, (void**)&cache);
- }
- FileFixifyCacheKey cacheKey(ret, out_d, in_d, fix, canon);
- QString cacheVal = cache->value(cacheKey);
- if(!cacheVal.isNull())
- return cacheVal;
-
//do the fixin'
QString pwd = qmake_getpwd();
if (!pwd.endsWith('/'))
@@ -2908,7 +2897,6 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
debug_msg(3, "Fixed[%d,%d] %s :: to :: %s [%s::%s] [%s::%s]", fix, canon, orig_file.toLatin1().constData(),
ret.toLatin1().constData(), in_d.toLatin1().constData(), out_d.toLatin1().constData(),
pwd.toLatin1().constData(), Option::output_dir.toLatin1().constData());
- cache->insert(cacheKey, ret);
return ret;
}