Repository navigation
Commit 8a9b841
committed
Improve performance of json dumping
json.dump uses the Python implementation of the json encoder instead of the C
implementation. While this saves a bit of memory while dumping data,
the performance impact is large: python/cpython#56343
Saving a user share with 3 million files to disk previously took 1 minute 13 seconds.
It now takes 14 seconds.
The C implementation of the json encoder doesn't support the 'indent' argument, so
stop using it.1 parent e5f4147 commit 8a9b841
2 files changed
Lines changed: 23 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | 266 | | |
275 | 267 | | |
276 | 268 | | |
277 | 269 | | |
278 | 270 | | |
279 | 271 | | |
280 | | - | |
| 272 | + | |
| 273 | + | |
281 | 274 | | |
282 | 275 | | |
283 | 276 | | |
| |||
2682 | 2675 | | |
2683 | 2676 | | |
2684 | 2677 | | |
2685 | | - | |
2686 | | - | |
| 2678 | + | |
| 2679 | + | |
2687 | 2680 | | |
2688 | | - | |
2689 | | - | |
| 2681 | + | |
| 2682 | + | |
2690 | 2683 | | |
2691 | 2684 | | |
2692 | 2685 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | 148 | | |
153 | 149 | | |
154 | 150 | | |
| |||
161 | 157 | | |
162 | 158 | | |
163 | 159 | | |
164 | | - | |
| 160 | + | |
| 161 | + | |
165 | 162 | | |
166 | 163 | | |
167 | 164 | | |
| |||
196 | 193 | | |
197 | 194 | | |
198 | 195 | | |
199 | | - | |
200 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
201 | 211 | | |
202 | 212 | | |
203 | 213 | | |
| |||
0 commit comments