mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Material: micro optimize map reading
Do only one map walk per read instead of two. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
bd3ec6af15
commit
79513e3a43
1 changed files with 7 additions and 5 deletions
|
@ -70,9 +70,10 @@ namespace {
|
|||
EndgameEvaluationFunction* f = NULL;
|
||||
|
||||
lock_grab(&EEFmapLock);
|
||||
|
||||
if (EEFmap.find(key) != EEFmap.end())
|
||||
f = EEFmap[key];
|
||||
|
||||
std::map<Key, EndgameEvaluationFunction*>::iterator it(EEFmap.find(key));
|
||||
if (it != EEFmap.end())
|
||||
f = it->second;
|
||||
|
||||
lock_release(&EEFmapLock);
|
||||
return f;
|
||||
|
@ -84,8 +85,9 @@ namespace {
|
|||
|
||||
lock_grab(&ESFmapLock);
|
||||
|
||||
if (ESFmap.find(key) != ESFmap.end())
|
||||
si = ESFmap[key];
|
||||
std::map<Key, ScalingInfo>::iterator it(ESFmap.find(key));
|
||||
if (it != ESFmap.end())
|
||||
si = it->second;
|
||||
|
||||
lock_release(&ESFmapLock);
|
||||
return si;
|
||||
|
|
Loading…
Add table
Reference in a new issue