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

RFC: allow IOBuffer to be parameterized and remove start/stop_reading #11554

Merged
merged 4 commits into from
Jun 8, 2015

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jun 3, 2015

ref #9888
ref #1925

(note: these two pull requests have gotten mixed up together in my local repository commits. i'll definitely fix that and sort them into proper commits before merging this)

@@ -1,23 +0,0 @@
// This file is a part of Julia. License is MIT: http://julialang.org/license
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this deletion looks unrelated, missed from a0e503e ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, looks like my branches got mixed up in the rebase

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs a rebase here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think strictly speaking no, just this file deletion could have been committed to master by itself at any time.

@vtjnash vtjnash changed the title RFC: allow IOBuffer to be parameterized RFC: allow IOBuffer to be parameterized and remove start/stop_reading Jun 3, 2015
@JeffBezanson
Copy link
Member

👍 💯 to the start_reading change.

The IOBuffer change seems like an awful lot of effort just to support read-only IOBuffers of substrings of ASCII or UTF-8. I haven't seen sufficient motivation for that.

end
end

wait_close(x) = if isopen(x) stream_wait(x,x.closenotify); end
wait_close(x) = wait_readnb(x, typemax(Int))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self note: revert this line

@vtjnash vtjnash force-pushed the jn/iobuffer_parameterized branch from 63cda45 to 9de4a9a Compare June 3, 2015 18:30
@vtjnash
Copy link
Member Author

vtjnash commented Jun 3, 2015

The IOBuffer change seems like an awful lot of effort just to support read-only IOBuffers of substrings of ASCII or UTF-8. I haven't seen sufficient motivation for that.

I really need to go through and split up these commits into bug fixes and changes. The actual parameterization of the IOBuffer is done in very few changes (most just changing of typed fields from IOBuffer to SimpleIOBuffer). The rest is either unrelated (but got mixed up in my local branches), or bugfixes / code simplifications.

I think the more useful motivating case for this is being able to make IOBuffers backed by SubArrays or SharedArrays.

@JeffBezanson
Copy link
Member

I wouldn't underestimate the annoyance of having both IOBuffer and SimpleIOBuffer. Although so far I'm still against the change, maybe the renaming should be reversed, to AnyIOBuffer and IOBuffer.

@ScottPJones
Copy link
Contributor

I don't know, I think this might be quite useful for certain types of operations, say where you've got data streaming into buffers, a buffer is filled, and then you start filling another buffer... normally trying to process the data in those buffers is a pain, but this would hide that, I think... and could be a big win for the sorts of stuff that I do. I don't care what the name is, just that the functionality is there, and that use can use these anywhere you'd read from an IOBuffer currently (without causing type instability or performance issues for code that doesn't use the new type IOBuffers...)

@vtjnash vtjnash force-pushed the jn/iobuffer_parameterized branch 2 times, most recently from 4ff1b04 to 507d17e Compare June 4, 2015 16:15
@vtjnash
Copy link
Member Author

vtjnash commented Jun 4, 2015

@JeffBezanson i've cleaned up the commits and done the renaming you suggested. i agree that is better. I initially though the abstract type would be useful for clients, but now realize that was largely false, since the primarily useful abstract type for annotation would be IO.

vtjnash added 4 commits June 5, 2015 23:56
, fix #10655 (closes #11530)

this also makes the read throttle more intelligent so that it doesn't
get tripped up by wait_nb requests for more than READ_BUFFER_SZ bytes
@vtjnash vtjnash force-pushed the jn/iobuffer_parameterized branch from 507d17e to 38888d5 Compare June 6, 2015 04:15
@vtjnash
Copy link
Member Author

vtjnash commented Jun 6, 2015

travis is now ok with this (modulo the OOM death on one of the attempts). any final thoughts before merging?

@ScottPJones
Copy link
Contributor

FWIW, LGTM 👍

@ScottPJones
Copy link
Contributor

Argh: spoke too soon, but this still can be merged and I can submit a PR later for the minor thing I just noticed.
It outputs a replacement character '\ufffd' if the Char is > 0x10ffff, but it doesn't check the surrogate range, which are also invalid, and should be replaced by '\ufffd'.

vtjnash added a commit that referenced this pull request Jun 8, 2015
allow IOBuffer to be parameterized, and remove the need for explicit start/stop_reading in user code
@vtjnash vtjnash merged commit 22b5c9d into master Jun 8, 2015
@vtjnash vtjnash deleted the jn/iobuffer_parameterized branch June 8, 2015 00:09
@vtjnash vtjnash mentioned this pull request Jul 15, 2015
tkelman added a commit to JuliaLang/Compat.jl that referenced this pull request Jul 9, 2016
tkelman added a commit that referenced this pull request Jul 10, 2016
and rename the parameterized version to `GeneralIOBuffer`
ref discussion at #11554 (comment)

Luckily very little code in base and no code in registered packages is using the constructor
for this type, only in dispatch (or in `precompile` calls) so this change should in theory not
be very noticeable. After we branch for release-0.5 we should consider removing the
parameterization and just call the type `IOBuffer`, since it doesn't look like anyone ever
uses any other type for the `data` field.
tkelman added a commit to JuliaLang/Compat.jl that referenced this pull request Jul 11, 2016
tkelman added a commit that referenced this pull request Jul 12, 2016
ref discussion at #11554 (comment)
it might be better to rename this to IOBuffer but I'm not sure how to make that work
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.

7 participants