libroot: Implement the general case of posix_spawn using load_image.
The goal here is to avoid potentially expensive fork()ing. The time for a fork() is (for a process with no real heap usage and thus few areas) 300-400us on my system. load_image() takes 3000us (3ms) or so, but this of course includes exec() time. Overall, for compiling HaikuDepot (with a tweaked jam to use posix_spawn on Haiku, not just on Linux) there is a slight decrease in time: before: real 1m21.727s user 1m2.131s sys 0m43.029s after: real 1m19.472s user 1m1.752s sys 0m41.740s Which is probably within the realm of "noise", so more benchmarks are needed. Likely if we tweak our jam usage to not need as many shells when running commands, this would be a much more noticeable change. Change-Id: I217f2476b1ed9aa18322b3c2bc8986571d89549a
This commit is contained in:
@@ -33,6 +33,8 @@ status_t __test_executable(const char *path, char *invoker);
|
||||
status_t __flatten_process_args(const char* const* args, int32 argCount,
|
||||
const char* const* env, int32* envCount, const char* executablePath,
|
||||
char*** _flatArgs, size_t* _flatSize);
|
||||
thread_id __load_image_at_path(const char* path, int32 argCount,
|
||||
const char **args, const char **environ);
|
||||
void _call_atexit_hooks_for_range(addr_t start, addr_t size);
|
||||
void __init_env(const struct user_space_program_args *args);
|
||||
void __init_env_post_heap(void);
|
||||
|
||||
Reference in New Issue
Block a user