New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xreadlines caching, file iterator #36878
Comments
Calling f.xreadlines() multiple times returns the same A file is an iterator - __iter__() returns self and next() calls |
Logged In: YES I posted some comments to python-dev. |
Logged In: YES Now invalidates cache on a seek. |
Logged In: YES I'm reviewing this and will check it in, or something like |
Logged In: YES Alas, there's a fatal flaw. The file object and the Oren, if you'd like to give up, please say so and I'll close |
Logged In: YES The version of the patch still makes a file an iterator but it no It is about 19% faster than xreadlines for normal text files and The methods readline and read do not use this readahead |
Logged In: YES This begins to look good. What's a normal text file? One with a million bytes? :-) Have you made sure this works as expected in Universal I'd like a patch that doesn't use #define WITH_READAHEAD_BUFFER. You might also experiment with larger buffer sizes (I |
Logged In: YES
Yes, it works just fine with universal newlines. Ok, the #ifdefs will go. Strange, a bigger buffer seems to actually slow it down... I'll |
Logged In: YES OK, I'll await a new patch. |
Logged In: YES Just FYI, in apps that do "read + process" in a loop, a small |
Logged In: YES Updated patch. What to do about the xreadlines method? The patch doesn't On my linux machine the highest performance is achieved for |
Logged In: YES Thanks! Making xreadlines an alias for __iter__ sounds about right, Then we should probably deprecate xreadlines, despite the |
Logged In: YES |
Logged In: YES Hm, test_file fails on a technicality. I'll take it from |
Logged In: YES Thanks! Checked in. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: