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

refactor I/O to do more buffering #3887

Open
Keno opened this issue Jul 30, 2013 · 7 comments
Open

refactor I/O to do more buffering #3887

Keno opened this issue Jul 30, 2013 · 7 comments
Labels
io Involving the I/O subsystem: libuv, read, write, etc.

Comments

@Keno
Copy link
Member

Keno commented Jul 30, 2013

Noting down ideas for the I/O refactor that I discussed with @JeffBezanson (do add anything I forgot).

  • Instead of having the basic I/O operate on single bytes, have a new interface that can read/write arrays of bytes (probably also nb_available)
  • All writes are buffered, with the buffer flushed when we enter the event loop next (or explicitly once we reach the system network buffer limit)
  • This new BufferedIO type would be the one to be extended for things like endianness, text-encodings, etc. rather than the underlying stream.
@kmsquire
Copy link
Member

As I mentioned in #3820, consider Apache's bucket brigades when implementing this. In particular, the referenced implementation

  • uses multiple, dynamically allocatable, possibly variable sized buffers
  • offers copy-free access to data in the buffer, when possible

I'm not sure how feasible in-place data access is in julia (it would likely have the same pointer/gc issues mentioned in #3224), but I would love to see this.

@vtjnash
Copy link
Member

vtjnash commented Aug 1, 2013

I'm curious how costly the copy strategy that I employed actually is, in practice, not because of how the compact is written, but because of the heuristics in ensureroom that I intended to limit the amount of data that gets copied. In particular, it only occurs just before a write (so read access doesn't move data). If the buffer was empty prior to the write, the pointers are immediately reset. Otherwise, they are reset if we will need to resize the buffer anyways, or the amount of space wasted at the beginning is greater than the amount of data in the buffer or there is a substantial amount of wasted space at the beginning of the buffer.

I imagine a strategy that was able to map/move/free entire pages (via mmap/mremap(MREMAP_FIXED)) could be significantly more efficient, but annoying to write.

@vtjnash
Copy link
Member

vtjnash commented Aug 24, 2015

moving this out of v0.4.x: there doesn't seem to be a pressing need to implement this right now, with all the possible issues that might be discovered later.

@vtjnash vtjnash modified the milestones: 0.5, 0.4.x Aug 24, 2015
@JeffBezanson JeffBezanson modified the milestones: 0.6.0, 0.5.0 Jan 27, 2016
@vtjnash vtjnash modified the milestones: 1.0, 0.6.0 Dec 22, 2016
@vtjnash
Copy link
Member

vtjnash commented Dec 22, 2016

We've slowly started to add this to more streams. It's still a good work item, but needs someone to spend a fair amount of focus on it.

@StefanKarpinski
Copy link
Member

Is this a breaking change or a performance optimization?

@StefanKarpinski StefanKarpinski modified the milestones: 1.x, 1.0 Jul 27, 2017
@ViralBShah
Copy link
Member

Close?

@JeffBezanson
Copy link
Member

I don't think we've done this yet.

@DilumAluthge DilumAluthge removed this from the 1.x milestone Mar 13, 2022
IanButterworth pushed a commit that referenced this issue Jun 4, 2024
Stdlib: Pkg
URL: https://github.com/JuliaLang/Pkg.jl.git
Stdlib branch: master
Julia branch: master
Old commit: ed7a8dca8
New commit: 4e43058c2
Julia version: 1.12.0-DEV
Pkg version: 1.12.0
Bump invoked by: @IanButterworth
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/Pkg.jl@ed7a8dc...4e43058

```
$ git log --oneline ed7a8dca8..4e43058c2
4e43058c2 Merge pull request #3887 from carlobaldassi/validate_versions
bc7c3207d abort querying more pacakge for hint auto complete (#3913)
a4016aed2 precompile repl switch (#3910)
a48c9c645 Fixed glitch in the manual (#3912)
d875aa213 Add timeout and new tests for resolver
aeb55f7f0 run artifact selection code with minimal compilation (#3899)
0180a0105 avoid doing some checks if the package will not be showed in status output (#3897)
c6c7ed502 improve precompilation for `st` in the Pkg REPL (#3893)
bffd0633c Add version validation during Graph simplification
c2ad07003 Fix padding in resolve's log journal printing
3eb86d29f Revert #2267, with better log message
acdbb727e Small extra check in Graph's check_consistency
1d446c224 Fix small bug in Graph constructor
3efc3cbff Fix show method for VersionSpecs
```

Co-authored-by: Dilum Aluthge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

No branches or pull requests

7 participants