Repository navigation
Commit 1610807
authored
Optimize io.BufferedReader.readline() when lines are close to the
buffer size (128 kB by default) or longer than the buffer size.
Replace the C loop searching for the newline byte in the buffer with
a memchr() call which is more efficient. In the good case,
it makes readline() up to 4x faster!
1 parent c120cae commit 1610807
2 files changed
Lines changed: 12 additions & 9 deletions
File tree
- Misc/NEWS.d/next/Library
- Modules/_io
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1280 | 1280 | | |
1281 | 1281 | | |
1282 | 1282 | | |
1283 | | - | |
1284 | | - | |
1285 | | - | |
1286 | | - | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
1290 | | - | |
1291 | | - | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
1292 | 1288 | | |
| 1289 | + | |
| 1290 | + | |
1293 | 1291 | | |
1294 | 1292 | | |
1295 | 1293 | | |
| |||
0 commit comments