Commit f2ee60f
commit-reach: optimize queue scan in ahead_behind
Apply the same nonstale_count optimization from the previous commit
to ahead_behind(). This replaces the remaining caller of the O(n)
queue_has_nonstale() scan with an O(1) counter check, allowing
queue_has_nonstale() to be removed.
ahead_behind() already deduplicates queue entries using the PARENT2
flag (via insert_no_dup), so the counter is maintained through
insert_no_dup() and mark_stale() using PARENT2 as the queued_flag.
Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent e742e7d commit f2ee60f
1 file changed
Lines changed: 12 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 64 | | |
75 | 65 | | |
76 | 66 | | |
| |||
1051 | 1041 | | |
1052 | 1042 | | |
1053 | 1043 | | |
1054 | | - | |
| 1044 | + | |
| 1045 | + | |
1055 | 1046 | | |
1056 | 1047 | | |
1057 | 1048 | | |
1058 | 1049 | | |
1059 | 1050 | | |
| 1051 | + | |
| 1052 | + | |
1060 | 1053 | | |
1061 | 1054 | | |
1062 | 1055 | | |
| |||
1082 | 1075 | | |
1083 | 1076 | | |
1084 | 1077 | | |
| 1078 | + | |
1085 | 1079 | | |
1086 | 1080 | | |
1087 | 1081 | | |
| |||
1100 | 1094 | | |
1101 | 1095 | | |
1102 | 1096 | | |
1103 | | - | |
| 1097 | + | |
1104 | 1098 | | |
1105 | 1099 | | |
1106 | | - | |
| 1100 | + | |
1107 | 1101 | | |
1108 | 1102 | | |
1109 | 1103 | | |
1110 | 1104 | | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1111 | 1108 | | |
1112 | 1109 | | |
1113 | 1110 | | |
| |||
1136 | 1133 | | |
1137 | 1134 | | |
1138 | 1135 | | |
1139 | | - | |
| 1136 | + | |
1140 | 1137 | | |
1141 | | - | |
| 1138 | + | |
1142 | 1139 | | |
1143 | 1140 | | |
1144 | 1141 | | |
| |||
0 commit comments