Closed
Description
It seems like, by default, the initial buffer size for the return value of getcwd
is set to 512 bytes:
rust/library/std/src/sys/unix/os.rs
Line 139 in 600820d
The default in glibc is defined as follows (https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/getcwd.c.html#61):
MAX (PATH_MAX, __getpagesize ())
This might cause some unnecessary linux kernel context switches for longer paths (multiple buffer resizes).
Is there a reason for not using a larger buffer (eg. identical to the glibc implementation)?
Metadata
Metadata
Assignees
Labels
No labels