Switched the managed JQuad container implementation from a vector to a map. This speeds up the cache lookup time from O(n) to O(log n). Hard to see a noticeable difference on win, but it definitely feels snappier on my psp, for instance, when browsing your library for a card, or your graveyard, etc.
I'm also noticing that the GetQuad(int) variant never seems to get hit, so I suspect that the ID lookup map is redundant. I left it alone as the JResourceManager base class forces the need for the function; I need to spend more time looking at just how much of JResourceManager we actually use at this point.
This commit is contained in:
@@ -162,6 +162,8 @@ public:
|
||||
JQuad* GetQuad(const string &quadName);
|
||||
JQuad* GetQuad(int id);
|
||||
|
||||
int AddQuadToManaged(const WManagedQuad& inManagedQuad);
|
||||
|
||||
//Our file redirect system.
|
||||
string graphicsFile(const string filename);
|
||||
string avatarFile(const string filename);
|
||||
@@ -207,7 +209,12 @@ private:
|
||||
WCache<WCachedTexture,JTexture> textureWCache;
|
||||
WCache<WCachedSample,JSample> sampleWCache;
|
||||
WCache<WCachedParticles,hgeParticleSystemInfo> psiWCache;
|
||||
vector<WManagedQuad*> managedQuads;
|
||||
|
||||
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
|
||||
ManagedQuadMap mManagedQuads;
|
||||
|
||||
typedef std::map<int, std::string> IDLookupMap;
|
||||
IDLookupMap mIDLookupMap;
|
||||
|
||||
//Statistics of record.
|
||||
unsigned int lastTime;
|
||||
|
||||
Reference in New Issue
Block a user