You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ChunkWriterThread::runcurrently calls create_dir_all() twice, which is useless at best but causes quite a lot of IO.
We can reduce IO further by asking for forgivness instead of permission and moving the create_dir_all()-call into a new error-path for fs::File::create(&tmp_path).unwrap();. As the path will exist for almost all but one calls to fs::File::create() per path, we should just try to create the file directly and only create the path structure in case we fail. This saves us from a lot of stat64-calls.
The text was updated successfully, but these errors were encountered:
The reason it's called twice is: rust-lang/rust#33707 which I recently fixed with: rust-lang/rust#39799 . It is yet hit stable, That PR also improves the the performance of create_dir_all and makes it "try first and check later".
You're right that it would be better to just try File::create first and mkdir only if it failed. Please submit a PR!
ChunkWriterThread::run
currently callscreate_dir_all()
twice, which is useless at best but causes quite a lot of IO.We can reduce IO further by asking for forgivness instead of permission and moving the
create_dir_all()
-call into a new error-path forfs::File::create(&tmp_path).unwrap();
. As the path will exist for almost all but one calls tofs::File::create()
perpath
, we should just try to create the file directly and only create the path structure in case we fail. This saves us from a lot of stat64-calls.The text was updated successfully, but these errors were encountered: