Opened 4 months ago
Last modified 2 months ago
#18947 new bug
shell exec is about 30 times slower than raw exec syscall — at Initial Version
Reported by: | X512 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | System/libroot.so | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
This is hrev57820.
Shell (Bash/Zsh etc.) execution time is very slow compared Linux/*BSD that significantly slow down Autotools based projects compilation and other tasks that heavilit yuse shell scripts. Raw exec syscall is significantly faster (30x). I am not sure is it kernel, libroot or shell port problem, it need more investigation.
loop.sh
:
#!sh if (( $1 <= 0 )) then exit fi exec loop.sh $(($1 - 1))
loop.c
:
#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char **argv) { if (argc < 2) return 1; int n = atoi(argv[1]); if (n <= 0) return 0; char buf[32]; sprintf(buf, "%d", n - 1); char *newArgs[3] = {argv[0], buf, NULL}; execvp(newArgs[0], newArgs); return 0; }
time ./loop.sh 1000
:
real 0m13.775s user 0m11.713s sys 0m1.875s
time ./loop 1000
:
real 0m0.409s user 0m0.144s sys 0m0.240s
Note:
See TracTickets
for help on using tickets.