Page MenuHomeWildfire Games

Use std::unordered_map for IGUIObject m_Settings
AbandonedPublic

Authored by elexis on Sep 4 2019, 2:33 PM.

Details

Reviewers
None
Summary

As mentioned in the discussion with Vladislav today, this map can become unordered.

Test Plan

Test the performance, for example with the CChart.cpp diff.

Event Timeline

elexis created this revision.Sep 4 2019, 2:33 PM
Vulcan added a comment.Sep 4 2019, 2:35 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/69/display/redirect

Vulcan added a comment.Sep 4 2019, 2:43 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/gui/IGUIObject.h
|  44| template·<typename·T>·class·GUI;
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'template<...' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/578/display/redirect

elexis planned changes to this revision.Sep 4 2019, 5:31 PM

According to Vladislavs tests, unordered_map is slower.

http://irclogs.wildfiregames.com/2019-09/2019-09-04-QuakeNet-%230ad-dev.log

12:52 < Vladislav> elexis: unordered_map is slower for me, 1.2ms vs 0.9ms (map)

This patch was used by Vladislav to measure:

elexis abandoned this revision.Sep 20 2019, 7:06 PM

Well it makes sense to use an ordered map, because it allows for logarithmic instead of linear lookup time.
https://en.cppreference.com/w/cpp/container/unordered_map/operator_at
https://en.cppreference.com/w/cpp/container/map/operator_at