Commit 8aaf8d7
dir.c: git-status: avoid is_excluded checks for tracked files
Checking if a file is in the index is much faster (hashtable lookup) than
checking if the file is excluded (linear search over exclude patterns).
Skip is_excluded checks for files: move the cache_name_exists check from
treat_file to treat_one_path and return early if the file is tracked.
This can safely be done as all other code paths also return path_ignored
for tracked files, and dir_add_ignored skips tracked files as well.
There's just one line left in treat_file, so move this to treat_one_path
as well.
Here's some performance data for git-status from the linux and WebKit
repos (best of 10 runs on a Debian Linux on SSD, core.preloadIndex=true):
| status | status --ignored
| linux | WebKit | linux | WebKit
-------+-------+--------+-------+---------
before | 0.218 | 1.583 | 0.321 | 2.579
after | 0.156 | 0.988 | 0.202 | 1.279
gain | 1.397 | 1.602 | 1.589 | 2.016
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent b07bc8c commit 8aaf8d7
1 file changed
Lines changed: 11 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | 1069 | | |
1092 | 1070 | | |
1093 | 1071 | | |
| |||
1211 | 1189 | | |
1212 | 1190 | | |
1213 | 1191 | | |
1214 | | - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
1215 | 1202 | | |
1216 | 1203 | | |
1217 | 1204 | | |
| |||
1223 | 1210 | | |
1224 | 1211 | | |
1225 | 1212 | | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
1229 | 1213 | | |
1230 | 1214 | | |
1231 | 1215 | | |
| |||
1242 | 1226 | | |
1243 | 1227 | | |
1244 | 1228 | | |
1245 | | - | |
| 1229 | + | |
1246 | 1230 | | |
1247 | 1231 | | |
1248 | 1232 | | |
| |||
0 commit comments