js_os_exec tries to close all fds in the range 3..sysconf(_SC_OPEN_MAX). When ulimit -n is set to something high (1 million on my system), that takes considerable time.
Maybe the loop is the best we can do on other systems, but on linux, replacing it with close_range(3, INT_MAX, 0) should speed it up considerably.
js_os_exec tries to close all fds in the range 3..sysconf(_SC_OPEN_MAX). When
ulimit -nis set to something high (1 million on my system), that takes considerable time.Maybe the loop is the best we can do on other systems, but on linux, replacing it with
close_range(3, INT_MAX, 0)should speed it up considerably.