Debian Codegraph @

benchmarks_backends.md

raw
1
2 These benchmarks compare the native Python `re` module ("simple" backend) with
3 the optional backends. They were run against the CPython source main branch from
4 2025-12-27 (commit 00e24b80e092e7d36dc189fd260b2a4e730a6e7f), configured and
5 compiled. `PathSpec` and `GitIgnoreSpec` are tested using preloaded `.gitignore`
6 patterns and file paths. File-system speed is not tested.
7
8
9 CPython 3.13.11 on Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
10 ----------
11
12 GitIgnoreSpec.match_files(): 6.5k files
13
14 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
15 | --: | --: | --: | --: | --: | --: |
16 | 1 | 163.4 | 91.4 | 0.56 | 87.2 | 0.53 |
17 | 5 | 64.4 | 74.3 | 1.15 | 87.9 | 1.36 |
18 | 15 | 24.9 | 67.3 | 2.70 | 84.3 | 3.38 |
19 | 25 | 17.5 | 31.5 | 1.80 | 82.5 | 4.73 |
20 | 50 | 9.1 | 21.1 | 2.31 | 82.4 | 9.01 |
21 | 100 | 4.9 | 32.7 | 6.62 | 77.6 | 15.73 |
22 | 150 | 3.6 | 30.3 | 8.41 | 73.0 | 20.25 |
23
24 PathSpec.match_files(): 6.5k files
25
26 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
27 | --: | --: | --: | --: | --: | --: |
28 | 1 | 165.5 | 102.2 | 0.62 | 87.8 | 0.53 |
29 | 5 | 65.7 | 84.2 | 1.28 | 88.0 | 1.34 |
30 | 15 | 29.2 | 72.4 | 2.48 | 78.5 | 2.69 |
31 | 25 | 16.0 | 32.8 | 2.06 | 79.2 | 4.96 |
32 | 50 | 9.3 | 20.4 | 2.20 | 77.0 | 8.29 |
33 | 100 | 5.2 | 25.3 | 4.83 | 74.4 | 14.21 |
34 | 150 | 3.7 | 28.6 | 7.68 | 72.8 | 19.58 |
35
36
37 PyPy 3.11.13 (7.3.20) on Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
38 ----------
39
40 GitIgnoreSpec.match_files(): 6.5k files
41
42 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
43 | --: | --: | --: | --: | --: | --: |
44 | 1 | 307.4 | 42.5 | 0.14 | - | - |
45 | 5 | 53.3 | 37.1 | 0.70 | - | - |
46 | 15 | 16.2 | 31.7 | 1.96 | - | - |
47 | 25 | 7.8 | 22.4 | 2.86 | - | - |
48 | 50 | 3.6 | 16.4 | 4.55 | - | - |
49 | 100 | 1.9 | 18.5 | 9.92 | - | - |
50 | 150 | 0.9 | 19.4 | 20.93 | - | - |
51
52 PathSpec.match_files(): 6.5k files
53
54 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
55 | --: | --: | --: | --: | --: | --: |
56 | 1 | 314.5 | 41.8 | 0.13 | - | - |
57 | 5 | 56.8 | 36.2 | 0.64 | - | - |
58 | 15 | 18.9 | 31.4 | 1.66 | - | - |
59 | 25 | 9.4 | 22.1 | 2.34 | - | - |
60 | 50 | 4.1 | 15.5 | 3.79 | - | - |
61 | 100 | 2.1 | 15.8 | 7.46 | - | - |
62 | 150 | 1.0 | 17.5 | 18.14 | - | - |
63
64
65 CPython 3.13.11 on 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
66 ----------
67
68 GitIgnoreSpec.match_files(): 6.5k files
69
70 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
71 | --: | --: | --: | --: | --: | --: |
72 | 1 | 271.9 | 187.2 | 0.69 | 196.3 | 0.72 |
73 | 5 | 106.0 | 161.1 | 1.52 | 198.8 | 1.88 |
74 | 15 | 46.1 | 146.5 | 3.18 | 193.3 | 4.19 |
75 | 25 | 27.2 | 55.4 | 2.04 | 191.8 | 7.05 |
76 | 50 | 15.7 | 37.8 | 2.40 | 190.7 | 12.12 |
77 | 100 | 8.5 | 66.9 | 7.88 | 190.9 | 22.47 |
78 | 150 | 5.8 | 60.5 | 10.46 | 173.0 | 29.91 |
79
80 PathSpec.match_files(): 6.5k files
81
82 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
83 | --: | --: | --: | --: | --: | --: |
84 | 1 | 276.2 | 204.6 | 0.74 | 194.9 | 0.71 |
85 | 5 | 104.7 | 172.0 | 1.64 | 194.1 | 1.85 |
86 | 15 | 47.2 | 154.6 | 3.27 | 184.5 | 3.91 |
87 | 25 | 29.8 | 56.8 | 1.90 | 183.8 | 6.16 |
88 | 50 | 16.0 | 35.2 | 2.20 | 181.8 | 11.39 |
89 | 100 | 8.7 | 53.4 | 6.15 | 179.7 | 20.69 |
90 | 150 | 6.1 | 56.3 | 9.19 | 176.8 | 28.84 |
91
92
93 PyPy 3.11.13 (7.3.20) on 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
94 ----------
95
96 GitIgnoreSpec.match_files(): 6.5k files
97
98 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
99 | --: | --: | --: | --: | --: | --: |
100 | 1 | 578.2 | 121.4 | 0.21 | - | - |
101 | 5 | 113.3 | 88.5 | 0.78 | - | - |
102 | 15 | 43.1 | 80.0 | 1.86 | - | - |
103 | 25 | 27.9 | 56.3 | 2.02 | - | - |
104 | 50 | 13.3 | 42.8 | 3.21 | - | - |
105 | 100 | 5.8 | 60.2 | 10.45 | - | - |
106 | 150 | 3.0 | 54.2 | 18.33 | - | - |
107
108 PathSpec.match_files(): 6.5k files
109
110 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
111 | --: | --: | --: | --: | --: | --: |
112 | 1 | 577.3 | 117.5 | 0.20 | - | - |
113 | 5 | 106.6 | 91.7 | 0.86 | - | - |
114 | 15 | 42.4 | 81.3 | 1.92 | - | - |
115 | 25 | 27.7 | 56.9 | 2.05 | - | - |
116 | 50 | 12.7 | 36.0 | 2.84 | - | - |
117 | 100 | 6.1 | 45.1 | 7.36 | - | - |
118 | 150 | 3.1 | 50.3 | 16.20 | - | - |
119
120
121 PyPy 3.10.16 (7.3.19) on 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
122 ----------
123
124 GitIgnoreSpec.match_files(): 6.5k files
125
126 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
127 | --: | --: | --: | --: | --: | --: |
128 | 1 | 589.9 | 106.6 | 0.18 | - | - |
129 | 5 | 117.2 | 91.9 | 0.78 | - | - |
130 | 15 | 44.5 | 81.3 | 1.83 | - | - |
131 | 25 | 27.4 | 44.0 | 1.60 | - | - |
132 | 50 | 13.0 | 32.1 | 2.48 | - | - |
133 | 100 | 5.5 | 51.8 | 9.36 | - | - |
134 | 150 | 3.1 | 47.1 | 15.28 | - | - |
135
136 PathSpec.match_files(): 6.5k files
137
138 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
139 | --: | --: | --: | --: | --: | --: |
140 | 1 | 581.4 | 106.7 | 0.18 | - | - |
141 | 5 | 135.7 | 90.7 | 0.67 | - | - |
142 | 15 | 54.8 | 81.7 | 1.49 | - | - |
143 | 25 | 31.5 | 43.0 | 1.36 | - | - |
144 | 50 | 12.5 | 30.2 | 2.41 | - | - |
145 | 100 | 6.3 | 42.2 | 6.69 | - | - |
146 | 150 | 3.3 | 44.2 | 13.51 | - | - |
147
148
149 CPython 3.13.11 on AMD RYZEN AI MAX+ 395 w/ Radeon 8060S
150 ----------
151
152 GitIgnoreSpec.match_files(): 6.5k files
153
154 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
155 | --: | --: | --: | --: | --: | --: |
156 | 1 | 426.1 | 261.3 | 0.61 | 291.5 | 0.68 |
157 | 5 | 159.6 | 230.2 | 1.44 | 288.5 | 1.81 |
158 | 15 | 69.4 | 206.5 | 2.97 | 279.3 | 4.02 |
159 | 25 | 45.8 | 76.5 | 1.67 | 275.9 | 6.02 |
160 | 50 | 23.6 | 53.9 | 2.29 | 275.1 | 11.66 |
161 | 100 | 13.4 | 92.4 | 6.91 | 271.3 | 20.29 |
162 | 150 | 8.7 | 84.6 | 9.70 | 246.5 | 28.26 |
163
164 PathSpec.match_files(): 6.5k files
165
166 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
167 | --: | --: | --: | --: | --: | --: |
168 | 1 | 439.1 | 282.4 | 0.64 | 289.7 | 0.66 |
169 | 5 | 163.3 | 244.6 | 1.50 | 291.8 | 1.79 |
170 | 15 | 76.5 | 214.9 | 2.81 | 272.9 | 3.57 |
171 | 25 | 48.0 | 78.3 | 1.63 | 271.8 | 5.66 |
172 | 50 | 23.7 | 50.3 | 2.13 | 268.3 | 11.34 |
173 | 100 | 13.1 | 77.2 | 5.88 | 264.0 | 20.10 |
174 | 150 | 9.8 | 79.9 | 8.14 | 263.7 | 26.87 |
175
176
177 PyPy 3.11.13 (7.3.20) on AMD RYZEN AI MAX+ 395 w/ Radeon 8060S
178 ----------
179
180 GitIgnoreSpec.match_files(): 6.5k files
181
182 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
183 | --: | --: | --: | --: | --: | --: |
184 | 1 | 898.6 | 179.0 | 0.20 | - | - |
185 | 5 | 161.7 | 132.0 | 0.82 | - | - |
186 | 15 | 62.8 | 120.1 | 1.91 | - | - |
187 | 25 | 38.8 | 85.7 | 2.21 | - | - |
188 | 50 | 20.8 | 63.2 | 3.03 | - | - |
189 | 100 | 9.9 | 91.5 | 9.24 | - | - |
190 | 150 | 5.2 | 82.5 | 15.79 | - | - |
191
192 PathSpec.match_files(): 6.5k files
193
194 | Patterns | simple<br>ops | hyperscan<br>ops | <br>x | re2<br>ops | <br>x |
195 | --: | --: | --: | --: | --: | --: |
196 | 1 | 913.0 | 176.9 | 0.19 | - | - |
197 | 5 | 170.1 | 132.7 | 0.78 | - | - |
198 | 15 | 69.7 | 121.2 | 1.74 | - | - |
199 | 25 | 42.4 | 83.7 | 1.97 | - | - |
200 | 50 | 21.0 | 59.1 | 2.81 | - | - |
201 | 100 | 10.8 | 69.4 | 6.45 | - | - |
202 | 150 | 5.7 | 74.1 | 13.07 | - | - |