-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
perf: lazy atexit
setup
#21053
perf: lazy atexit
setup
#21053
Conversation
/bench startup_nop_empty |
startup_nop_empty
start: id: server: |
extern "C" fn reset_stdio() { | ||
// SAFETY: Reset the stdio state. | ||
unsafe { tcsetattr(libc::STDIN_FILENO, 0, &ORIG_TERMIOS.unwrap()) }; | ||
static ORIG_TERMIOS: OnceCell<Option<termios>> = OnceCell::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 perfect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
libc::atexit
incurrs 2% dyld cost at startup on macOS. This PR moves the setup to when the tty mode is changed using op_stdin_set_raw.