Browse Source

Merge pull request #373 from Hoikas/linking-perf

Low-Hanging Linking Performance
Branan Purvine-Riley 11 years ago
parent
commit
7c0e3e2a61
  1. 25
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 10
      Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp
  3. 4
      Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h
  4. 8
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp

25
Sources/Plasma/Apps/plClient/plClient.cpp

@ -1279,19 +1279,28 @@ void plClient::IProgressMgrCallbackProc(plOperationProgress * progress)
// Increments the taskbar progress [Windows 7+]
#ifdef HS_BUILD_FOR_WIN32
if (gTaskbarList)
if (gTaskbarList && fInstance->GetWindowHandle())
{
HWND hwnd = fInstance->GetWindowHandle(); // lazy
static TBPFLAG lastState = TBPF_NOPROGRESS;
TBPFLAG myState;
// So, calling making these kernel calls is kind of SLOW. So, let's
// hide that behind a userland check--this helps linking go faster!
if (progress->IsAborting())
// We'll assume this is fatal
gTaskbarList->SetProgressState(hwnd, TBPF_ERROR);
myState = TBPF_ERROR;
else if (progress->IsLastUpdate())
gTaskbarList->SetProgressState(hwnd, TBPF_NOPROGRESS);
myState = TBPF_NOPROGRESS;
else if (progress->GetMax() == 0.f)
gTaskbarList->SetProgressState(hwnd, TBPF_INDETERMINATE);
myState = TBPF_INDETERMINATE;
else
// This will set TBPF_NORMAL for us
gTaskbarList->SetProgressValue(hwnd, (ULONGLONG)progress->GetProgress(), (ULONGLONG)progress->GetMax());
myState = TBPF_NORMAL;
if (myState == TBPF_NORMAL)
// This sets us to TBPF_NORMAL
gTaskbarList->SetProgressValue(fInstance->GetWindowHandle(), (ULONGLONG)progress->GetProgress(), (ULONGLONG)progress->GetMax());
else if (myState != lastState)
gTaskbarList->SetProgressState(fInstance->GetWindowHandle(), myState);
lastState = myState;
}
#endif

10
Sources/Plasma/NucleusLib/pnKeyedObject/plKey.cpp

@ -204,16 +204,6 @@ plKey &plKey::operator=( const plKey &rhs )
return *this;
}
bool plKey::operator==( const plKey &rhs ) const
{
return fKeyData == rhs.fKeyData;
}
bool plKey::operator==( const plKeyData *rhs ) const
{
return fKeyData == rhs;
}
plKeyData *plKey::operator->() const
{
return fKeyData;

4
Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h

@ -67,8 +67,8 @@ public:
~plKey();
plKey& operator=(const plKey& rhs);
bool operator==(const plKey& rhs) const;
bool operator==(const plKeyData* rhs) const;
bool operator==(const plKey& rhs) const { return fKeyData == rhs.fKeyData; }
bool operator==(const plKeyData* rhs) const { return fKeyData == rhs; }
bool operator!=(const plKey& rhs) const { return !(*this == rhs); }
bool operator!=(const plKeyData* rhs) const { return !(*this == rhs); }

8
Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp

@ -169,9 +169,11 @@ bool plRegistryKeyList::SetKeyUnused(plKeyImp* key, LoadStatus& loadStatusChange
// Fixed Keys use ID == 0
if (id == 0)
hsAssert(key->GetUoid().GetLocation() == plLocation::kGlobalFixedLoc, "key id == 0 but not fixed?");
else if (id < fKeys.size()) {
if (fKeys[id]->GetUoid().GetObjectID() == id)
foundKey = fKeys[id];
// Recall that vectors are index zero but normal object IDs are index one...
else if (id <= fKeys.size()) {
if (fKeys[id-1]->GetUoid().GetObjectID() == id)
foundKey = fKeys[id-1];
}
// Last chance: do a slow name search for that key.

Loading…
Cancel
Save