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
Quick microbenchmark which demonstrates the performance difference; it's not in Rust, but I believe it demonstrates the underlying idea here. Measured on macOS 10.13.2:
~ ❯❯❯ python -mtimeit -s "import os; f = open('/dev/zero')" "os.fstat(f.fileno())"
1000000 loops, best of 3: 1.88 usec per loop
~ ❯❯❯ python -mtimeit -s "import os; f = open('/dev/zero')" "os.fstat(f.fileno())"
100000 loops, best of 3: 1.91 usec per loop
~ ❯❯❯ python -mtimeit -s "import os; f = open('/dev/zero')" "os.fstat(f.fileno())"
1000000 loops, best of 3: 1.91 usec per loop
~ ❯❯❯
~ ❯❯❯
~ ❯❯❯
~ ❯❯❯ python -mtimeit -s "import os; f = open('/dev/zero')" "os.stat('/dev/zero')"
100000 loops, best of 3: 3.69 usec per loop
~ ❯❯❯ python -mtimeit -s "import os; f = open('/dev/zero')" "os.stat('/dev/zero')"
100000 loops, best of 3: 3.65 usec per loop
~ ❯❯❯ python -mtimeit -s "import os; f = open('/dev/zero')" "os.stat('/dev/zero')"
100000 loops, best of 3: 3.78 usec per loop
mbrubeck
added a commit
to mbrubeck/rust
that referenced
this issue
Jan 17, 2018
Use File::metadata instead of fs::metadata to choose buffer size
This replaces a `stat` syscall with `fstat` or similar, which can be faster. Fixesrust-lang#47519.
Uh oh!
There was an error while loading. Please reload this page.
Follow up to #47324. Instead of calling
stat
and thenopen
, doopen
and thenfstat
.In my tests on macOS this is significantly faster.
The text was updated successfully, but these errors were encountered: