forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit59464bd
committed
Improve implementation of GEQO's init_tour() function.
Rather than filling a temporary array and then copying values to theoutput array, we can generate the required random permutation in-placeusing the Fisher-Yates shuffle algorithm. This is shorter as well asmore efficient than before. It's pretty unlikely that anyone wouldnotice a speed improvement, but shorter code is better.Nathan Wagner, edited a bit by me1 parent7bd099d commit59464bd
1 file changed
+19
-25
lines changedLines changed: 19 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 | 32 |
| |
37 | 33 |
| |
38 | 34 |
| |
39 | 35 |
| |
40 |
| - | |
41 |
| - | |
42 |
| - | |
43 |
| - | |
| 36 | + | |
| 37 | + | |
44 | 38 |
| |
45 |
| - | |
46 |
| - | |
47 |
| - | |
48 |
| - | |
49 |
| - | |
50 |
| - | |
51 |
| - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
52 | 50 |
| |
53 |
| - | |
| 51 | + | |
54 | 52 |
| |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
62 | 58 |
| |
63 |
| - | |
64 |
| - | |
65 | 59 |
| |
66 | 60 |
| |
67 | 61 |
| |
|
0 commit comments
Comments
(0)