Modified permuteExistingNumbers(), moving the isValidSurrealNumber() check into the...
authorAaron Taylor <ataylor@subgeniuskitty.com>
Sat, 15 May 2021 22:43:01 +0000 (15:43 -0700)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Sat, 15 May 2021 22:43:01 +0000 (15:43 -0700)
commit70e31d9ccb656e498a958e6623bc64234414e562
treef34012513d1dc32cd0321b06c334abac9070a6a3
parent8be725f2ca1fc13ac01f8f3a553e6a8803d08d91
Modified permuteExistingNumbers(), moving the isValidSurrealNumber() check into the symbol-permutation loop.

Based on profiling, such a large quantity of invalid numbers was being
generated that data operations were sucking up a significant portion of total
program runtime.

Benchmarking command:
    time ./ch1-breeding-numbers -generations 13 -silent
    go tool pprof ch1-breeding-numbers 13gen-memprofile-gen12.mprof
        top25

Before:
    38.303u 2.233s 0:23.41 173.1%   0+0k 40+62io 354pf+0w
    Showing nodes accounting for 2.29GB, 100% of 2.29GB total

After:
    23.435u 0.887s 0:19.54 124.4%   0+0k 40+52io 347pf+0w
    Showing nodes accounting for 1.12GB, 99.55% of 1.13GB total
chapter-1-experiments/ch1-breeding-numbers.go