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

faster filesize and read(::IOStream) #35925

Merged
merged 1 commit into from
May 21, 2020
Merged

faster filesize and read(::IOStream) #35925

merged 1 commit into from
May 21, 2020

Conversation

JeffBezanson
Copy link
Member

  • Skip the stat call for reading entire files when the file is small (<32kb, the default buffer size)
  • Remove a redundant extra eof check in readbytes_all!
  • Speed up filesize by using lseek instead of stat. I don't know whether this will be faster on all systems. On our end, it removes an allocation, since the stat code is quite old and uses an Array instead of a Ref to get the data from C. We might be able to remove that allocation sometimes, so I can try that too.

@JeffBezanson JeffBezanson added performance Must go faster io Involving the I/O subsystem: libuv, read, write, etc. labels May 18, 2020
@JeffBezanson JeffBezanson merged commit fab5207 into master May 21, 2020
@JeffBezanson JeffBezanson deleted the jb/fasterread branch May 21, 2020 21:35
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 11, 2020
Comment on lines +503 to +504
b = StringVector(nb)
readbytes_all!(s, b, nb)
Copy link
Member

Choose a reason for hiding this comment

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

We need to handle the case where this is a directory; we don't want to return a successful zero-byte read of a directory.

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. performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants