Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faster move gen by replacing hash map with [[[bool; 4]; 25]; 10] #2

Closed
wants to merge 1 commit into from

Conversation

citrus610
Copy link

i tried replacing hash map with [[[bool; 4]; 25]; 10] and got some improvement in finding underground locks, no improvement in finding above stack locks.

empty/I                 time:   [3.9706 us 3.9844 us 3.9999 us]
                        change: [-0.4758% +0.0272% +0.5738%] (p = 0.92 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  2 (2.00%) high mild
  12 (12.00%) high severe
empty/O                 time:   [2.2432 us 2.2508 us 2.2600 us]
                        change: [-1.2114% -0.5206% +0.0680%] (p = 0.11 > 0.05)
                        No change in performance detected.
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe
empty/T                 time:   [4.3354 us 4.3541 us 4.3756 us]
                        change: [-0.3336% +0.4321% +1.1594%] (p = 0.26 > 0.05)
                        No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
  8 (8.00%) high mild
  5 (5.00%) high severe
empty/L                 time:   [3.6484 us 3.6622 us 3.6776 us]
                        change: [-0.8810% -0.3863% +0.1238%] (p = 0.14 > 0.05)
                        No change in performance detected.
Found 15 outliers among 100 measurements (15.00%)
  7 (7.00%) high mild
  8 (8.00%) high severe
empty/J                 time:   [3.6452 us 3.6559 us 3.6683 us]
                        change: [-0.5886% -0.1681% +0.3141%] (p = 0.47 > 0.05)
                        No change in performance detected.
Found 11 outliers among 100 measurements (11.00%)
  3 (3.00%) high mild
  8 (8.00%) high severe
empty/S                 time:   [3.6630 us 3.6760 us 3.6919 us]
                        change: [-1.1938% -0.4172% +0.3716%] (p = 0.29 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  4 (4.00%) high mild
  10 (10.00%) high severe
empty/Z                 time:   [3.6418 us 3.6553 us 3.6712 us]
                        change: [-0.6419% -0.0282% +0.5809%] (p = 0.93 > 0.05)
                        No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
  4 (4.00%) high mild
  9 (9.00%) high severe

tspin/I                 time:   [3.5904 us 3.5980 us 3.6066 us]
                        change: [-0.6264% +0.1900% +1.1189%] (p = 0.67 > 0.05)
                        No change in performance detected.
Found 15 outliers among 100 measurements (15.00%)
  3 (3.00%) high mild
  12 (12.00%) high severe
tspin/O                 time:   [1.9749 us 1.9826 us 1.9911 us]
                        change: [-2.1759% -1.6861% -1.1658%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  6 (6.00%) high mild
  8 (8.00%) high severe
tspin/T                 time:   [4.4118 us 4.4245 us 4.4386 us]
                        change: [-10.940% -10.279% -9.6240%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  5 (5.00%) high mild
  7 (7.00%) high severe
tspin/L                 time:   [3.7636 us 3.7781 us 3.7954 us]
                        change: [-8.6718% -7.7160% -6.8341%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  2 (2.00%) high mild
  11 (11.00%) high severe
tspin/J                 time:   [3.7569 us 3.7667 us 3.7787 us]
                        change: [-8.2669% -7.4324% -6.6021%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  4 (4.00%) high mild
  12 (12.00%) high severe
tspin/S                 time:   [3.6540 us 3.6684 us 3.6848 us]
                        change: [+0.2953% +0.8696% +1.5409%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 14 outliers among 100 measurements (14.00%)
  5 (5.00%) high mild
  9 (9.00%) high severe
tspin/Z                 time:   [3.6600 us 3.6756 us 3.6926 us]
                        change: [-8.4859% -7.5394% -6.7363%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  7 (7.00%) high mild
  7 (7.00%) high severe

dtd/I                   time:   [4.0429 us 4.0727 us 4.1086 us]
                        change: [+0.1255% +0.7642% +1.4466%] (p = 0.02 < 0.05)
                        Change within noise threshold.
Found 19 outliers among 100 measurements (19.00%)
  5 (5.00%) high mild
  14 (14.00%) high severe
dtd/O                   time:   [2.1878 us 2.1952 us 2.2049 us]
                        change: [-0.9129% -0.4554% +0.0186%] (p = 0.06 > 0.05)
                        No change in performance detected.
Found 16 outliers among 100 measurements (16.00%)
  6 (6.00%) high mild
  10 (10.00%) high severe
dtd/T                   time:   [5.2238 us 5.2389 us 5.2568 us]
                        change: [-17.388% -16.791% -16.214%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 18 outliers among 100 measurements (18.00%)
  11 (11.00%) high mild
  7 (7.00%) high severe
dtd/L                   time:   [4.0684 us 4.0866 us 4.1099 us]
                        change: [-6.7258% -6.1156% -5.4530%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 18 outliers among 100 measurements (18.00%)
  7 (7.00%) high mild
  11 (11.00%) high severe
dtd/J                   time:   [4.2975 us 4.3066 us 4.3181 us]
                        change: [-10.494% -10.008% -9.5361%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  3 (3.00%) high mild
  8 (8.00%) high severe
dtd/S                   time:   [3.8563 us 3.8681 us 3.8824 us]
                        change: [-0.5871% -0.0810% +0.4407%] (p = 0.77 > 0.05)
                        No change in performance detected.
Found 15 outliers among 100 measurements (15.00%)
  5 (5.00%) high mild
  10 (10.00%) high severe
dtd/Z                   time:   [3.8629 us 3.8732 us 3.8856 us]
                        change: [-11.044% -10.108% -9.3039%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe

terrible/I              time:   [13.719 us 13.757 us 13.803 us]
                        change: [-74.513% -74.267% -74.037%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  8 (8.00%) high mild
  6 (6.00%) high severe
terrible/O              time:   [7.6202 us 7.6441 us 7.6708 us]
                        change: [-54.877% -54.532% -54.187%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  3 (3.00%) high mild
  9 (9.00%) high severe
terrible/T              time:   [11.857 us 11.904 us 11.960 us]
                        change: [-64.749% -64.279% -63.861%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  4 (4.00%) high mild
  12 (12.00%) high severe
terrible/L              time:   [10.919 us 10.945 us 10.976 us]
                        change: [-63.691% -63.411% -63.151%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  1 (1.00%) high mild
  9 (9.00%) high severe
terrible/J              time:   [11.059 us 11.088 us 11.121 us]
                        change: [-59.809% -59.588% -59.365%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  6 (6.00%) high mild
  4 (4.00%) high severe
terrible/S              time:   [10.985 us 11.023 us 11.065 us]
                        change: [-76.858% -76.700% -76.525%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  8 (8.00%) high mild
  3 (3.00%) high severe
terrible/Z              time:   [10.796 us 10.832 us 10.871 us]
                        change: [-72.138% -71.911% -71.706%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  8 (8.00%) high mild
  8 (8.00%) high severe

@MinusKelvin
Copy link
Owner

There are a number of issues with this PR:

  1. You changed a lot more than just replacing the hash map with a [[[bool; 4]; 25]; 10].
  2. The code does not compile (assigns twice to immutable variable, line 202).
  3. I don't have to look very hard at your rewrite to know that it does not count the minimum number of softdrops to place in a location correctly.
  4. I tested this with battletris using game config ppt@2 as an elo gainer: 1352 - 1536 LLR: -2.96 (-2.94, 2.94) Elo: -22.17 ± 12.69
  5. A [[[bool; 4]; 25]; 10] is not large enough in general (tetris boards are 40 rows tall), and one game in the above match was forfeit due to a crash as a result of this.

That being said, there is likely some performance to be gained here by abandoning precise softdrop counting in favor of an approximation, and then replacing the hashmaps and priority queue with alternative datastructures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants