Commit 8ca6ac1
committed
Do not hash twice
Sets already use the __hash__() method of each object to decide if an
object is in it. When we use the sha1 we are therefore hashing twice.
The impact is on performance. Following the performance before and after
this patch to parse the entire Linux Kernel tree with a big exclude
list.
Before:
real 2m20.959s
user 2m16.888s
sys 0m1.386s
After:
real 1m35.169s
user 1m28.719s
sys 0m1.354s1 parent 363d289 commit 8ca6ac1
1 file changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
124 | | - | |
| 123 | + | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
| |||
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
255 | | - | |
| 254 | + | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
| |||
0 commit comments