-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
More efficient fix for #13559. #13638
Conversation
|
@tkelman Sure, should I do that? I did some more benchmarking and it looks like memory-wise we're on par with the C version, but about 3x slower for something like this: function bench_readInt64()
buf = Array{Int64}(1000000)
f = open("/dev/zero", "r")
for i = 1:1000000
buf[i] = myread(f, Int64)
end
close(f)
return buf
end Perhaps someone more experienced can say if this is a reasonable tradeoff. |
Yes, searching all of github for uses of |
You're right. It would be a new pull request, is that okay? I don't know if there's such a thing as a followup pull request. |
I think it would be better as a separate commit within this PR. |
just adding a cross-reference to the past PR: #12281 |
Since the C function is only used by this particular Julia function, a small change in the C code would fix #13559, without affecting the rest of Julia or performance. I will follow up with a separate pull request. |
You could also force push over the same branch, either here or reopen #13620 then force push to your |
e45f72d
to
8534af5
Compare
The commit went through, but looks like it caused a hang on Travis (e: and appveyor). Do you have a local source build, do you see the same thing in tests? What platform are you on? |
It could be loop I added. My computer just finished building LLVM; it'll be another ~20 min before I can confirm. |
I must be missing something, the only commit I can see here changes the C code. Did you destroy the PR when you force-pushed? |
Yes, this supersedes my previous attempt, which I still have on a local branch. |
OK. The indentation fix didn't move the curly braces, though. Also, adding a test is the only way to make sure this doesn't regress in the future. |
@nalimilan I looked at the rest of the file and it seems to use the same style for loops. The build hangs on both my linux boxes as well. This might be too invasive of a change as |
Could you squash the commits? |
Sorry, but how would you recommend I go about doing that? |
You do |
Got it, thanks. The main difficulty with tests is that it is hard to make assumptions about |
If you can make a FIFO reproduce the conditions that were causing the EOFError without this PR, that sounds like a good test. Might have to be |
FIFOs work like a charm. Should I put the tests in a new .jl file? |
nah, |
I have no idea how to do this in Windows, unfortunately. Would it be worth adding a non-blocking test for n-byte read that worked on all platforms? It wouldn't cover the RNG case but that problem doesn't affect in Windows anyway. |
Yeah if that wouldn't be much trouble to write, more tests is always good on principle. |
Is there anything else that needs to be done? Docs? |
…e identical to baseline. Fixed infinite loop in previous fix for JuliaLang#13559. Do not throw EOFError if buffer already contains n bytes. JuliaLang#13559
Uses the qualified path to launch julia
…ufficient bytes read.
This is pretty subtle to be worth mentioning in the docs I think. Thanks for the PR! @vtjnash does this look okay to merge? |
More efficient fix for #13559.
Thanks @hessammehr for pursuing this through the iterations. We appreciate the contribution! |
You're welcome! This is a pretty fantastic community; thanks for being so patient with me everyone. |
Thoughts on whether this should be backported for 0.4.2? |
looks safe |
This fix causes far fewer allocations than the previous PR #13632. Performance identical to C code.