diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-05-17 13:05:26 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-22 10:54:51 +0300 |
commit | 9b91d68df0a812b2fa0dd3da3f06ff0724033a46 (patch) | |
tree | bf09cf336aaf367830976cabaea19ce53aea7364 /src/plugins/sceneparsers/assimp/assimphelpers.h | |
parent | 7c5f56277cd0c7450a168af6188ee4753655ca31 (diff) |
assimp plugin: replace QMap with a C array
The keys are statically known, short, and few, so replace the
QMap<QByteArray, OpenMode> with a C array of a {char[2]; OpenMode}
struct, which occupies just 40B in read-only memory. We don't even
need to sort the list, as binary search in a list of ten entries is
slower than linear search (five comparisons each, on average, with the
linear scan having a predictable memory access pattern.
This is a port of dd1d8f51e67ec93031fdd7f7930d63761d1238e6 to the
other copy of this code, which shows that arguments like 'this is just
a tool, not a library' are ill-advised. Code _will_ be copied.
Change-Id: Ie04137f94e487ce998ec077daf655b09bcbbcfc7
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/plugins/sceneparsers/assimp/assimphelpers.h')
-rw-r--r-- | src/plugins/sceneparsers/assimp/assimphelpers.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.h b/src/plugins/sceneparsers/assimp/assimphelpers.h index 0db22ce7b..fd102213c 100644 --- a/src/plugins/sceneparsers/assimp/assimphelpers.h +++ b/src/plugins/sceneparsers/assimp/assimphelpers.h @@ -55,7 +55,6 @@ #include <assimp/IOStream.hpp> #include <assimp/IOSystem.hpp> #include <QtCore/QIODevice> -#include <QtCore/QMap> QT_BEGIN_NAMESPACE @@ -84,15 +83,10 @@ private: class AssimpIOSystem : public Assimp::IOSystem { public : - AssimpIOSystem(); - ~AssimpIOSystem(); bool Exists(const char *pFile) const override; char getOsSeparator() const override; Assimp::IOStream *Open(const char *pFile, const char *pMode) override; void Close(Assimp::IOStream *pFile) override; - -private: - QMap<QByteArray, QIODevice::OpenMode> m_openModeMaps; }; } // namespace AssimpHelper |