Page MenuHomeWildfire Games

Remove useless Random class
ClosedPublic

Authored by Stan on Apr 8 2019, 8:42 PM.

Details

Reviewers
Angen
vladislavbelov
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22178: Fix rP22175. Refs #5428
Summary

Random.h is currently used only in one test, and can be safely replaced by mersenne_twister for test purposes. As it's not used anywhere else it's useless and can be removed.

Test Plan

Check that the removal make sense.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 7140
Build 11648: Vulcan BuildJenkins

Event Timeline

Stan updated this revision to Diff 7703.Apr 8 2019, 8:42 PM
Stan created this revision.

Fix include order.

Vulcan added a subscriber: Vulcan.Apr 8 2019, 11:03 PM

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

Linter detected issues:
Executing section Source...

source/simulation2/components/tests/test_RangeManager.h
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1182/display/redirect

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

Link to build: https://jenkins.wildfiregames.com/job/differential/1183/display/redirect

Angen accepted this revision.Apr 9 2019, 9:03 PM

I accept this because:

  1. Project builds
  2. WELL512 is used only to test rangeManager
  3. claims to be effectively a better version of MT19937, however used only once for test since 2011 (mt19937 requires 2496 bytes - not really too much I think)
  4. looks to me like not needed class just for this file ( I do not think anyone runs tests every day to need this boost in memory )
  5. boost::mt19937 is used in: test_Sqrt (last change in file 2011 after WELL512 introduction), Noise (2006 introduction with mt19937 not replaced by WELL512), ObjectBase, ParticleManager
This revision is now accepted and ready to land.Apr 9 2019, 9:03 PM

What's about performance?

Stan added a comment.Apr 9 2019, 9:12 PM

That's a test so it doesn't matter much.

In D1821#74573, @Stan wrote:

That's a test so it doesn't matter much.

Actually we run all tests on our server for each diff, so it does matters if it significantly slower.

Also what's about distribution?

Stan added a comment.Apr 9 2019, 9:26 PM

Well if distribution did matter we would use it everywhere no ?

It's a small loop so by looking at the profiling I did today won't affect it much.

The WELL512 usage was introduces in rP10446 along a bug fixing. So the only question is: would be enough to have the mt19937 to prevent the bug.

vladislavbelov accepted this revision.Apr 9 2019, 9:42 PM

I suppose we won't loose distribution here, at least we won't notice it.

Stan added a comment.Apr 9 2019, 9:55 PM

Thanks for the review guys !

Stan closed this revision.Apr 9 2019, 11:53 PM

Fixed by rP22175