Skip to content
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

WIP: start trying to fix on julia nightly #19

Closed
wants to merge 1 commit into from
Closed

Conversation

tkelman
Copy link
Contributor

@tkelman tkelman commented Jan 20, 2016

Still getting a cannot resize array with shared data, not sure how to best deal with that. Commenting out the readbytes! method that was added in JuliaLang/julia#14667 seems to work, but may reintroduce the perf issue in base. cc @vtjnash

One ugly way to fix this is to change this line to
n = invoke(readbytes!, (IO, AbstractArray{UInt8}, Any), jl_ctx, jl_msg, sz)

Or JuliaLang/julia#14699 may change the behavior here. Regardless of the fix, I could use some help writing tests in base that are representative of the way this package needs to use IO functions. First for calling readbytes! with a non-Int input nb, where widening wait_readnb(x::LibuvStream, nb::Int) and wait_readnb(s::BufferStream, nb::Int) to accept Integer should be safe as far as I can tell. I can figure out BufferStream (bufstr = BufferStream(); data = UInt8[0,0,0,0,0]; sz = UInt(5); write(bufstr, data+1); readbytes!(bufstr, data, sz)) but not sure how to do any of the other LibuvStream subtypes. From what I can tell, jl_ctx when this package executes its tests is always a TCPSocket here.

@vtjnash
Copy link
Member

vtjnash commented Jan 20, 2016

i think the issue is that i assumed resize!(b, nr) would be a no-op if length(b) == nr, but that's not true in this instance. it looks like #14699 should fix that

@tkelman
Copy link
Contributor Author

tkelman commented Jan 20, 2016

Yes it looks that way to me as well. I think 14699 is likely too big for backporting, so what's the right approach w.r.t. backporting the original change? Does it do any good if the introduced readbytes! method is left out?

@vtjnash
Copy link
Member

vtjnash commented Jan 20, 2016

yeah, that's still most of the improvement. could also add a test before the call to resize! and skip it if it should be a no-op

@tkelman
Copy link
Contributor Author

tkelman commented Jan 25, 2016

I think this is going to get fixed on nightly, making this unnecessary. Still need more tests in base that are representative of what this package needs.

@vtjnash can you clarify, by "that's still most of the improvement" do you mean the parts of the change other than the new method?

@vtjnash
Copy link
Member

vtjnash commented Jan 26, 2016

yes. it's still a huge speedup to add just the fastpath optimizations for the wait_nb and eof methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants