we find sometime, exec shell file slowly.
we have test shell script,it just test hostname for 1000 times.
start_time=$(date +%s)
for i in {1..1000}; do
hostname > /dev/null
done
end_time=$(date +%s)
cost_time=$[ $end_time-$start_time ]
echo "共耗时:${cost_time}s"
In 48C50G Mac OS
# bladmin @ Hack-Mshylf-01-S3 in ~ [12:58:02]
$ time sh aaa.sh
共耗时:15s
sh aaa.sh 4.96s user 10.49s system 102% cpu 15.053 total
# bladmin @ Hack-Mshylf-01-S3 in ~ [12:58:19]
$ time sh aaa.sh
共耗时:14s
sh aaa.sh 4.74s user 10.25s system 103% cpu 14.496 total
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:03:22]
$ time sh aaa.sh
共耗时:13s
sh aaa.sh 4.34s user 9.41s system 103% cpu 13.244 total
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:04:21]
$ sysctl hw.physicalcpu
hw.physicalcpu: 48
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:04:41]
$ sysctl hw.logicalcpu
hw.logicalcpu: 48
In 4C50G Mac OS
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:09:15]
$ sh aaa.sh
共耗时:6s
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:09:26]
$ sh aaa.sh
共耗时:7s
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:09:35]
$ time sh aaa.sh
共耗时:7s
sh aaa.sh 2.06s user 4.08s system 93% cpu 6.591 total
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:09:45]
$ time sh aaa.sh
共耗时:5s
sh aaa.sh 1.65s user 3.19s system 89% cpu 5.385 total
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:09:54]
$ time sh aaa.sh
共耗时:6s
sh aaa.sh 1.84s user 3.46s system 92% cpu 5.741 total
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:10:04]
$ sysctl hw.physicalcpu
hw.physicalcpu: 4
# bladmin @ Hack-Mshylf-01-S3 in ~ [13:10:07]
$ sysctl hw.logicalcpu
hw.logicalcpu: 4
@sickcodes commented on GitHub (Jul 11, 2022):
Thank you for this 😁
This is good except this will use CPU
```
for i in {1..1000}; do
hostname > /dev/null
done
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @LiushuiXiaoxia on GitHub (Jul 6, 2022).
Forgive my bad english
we find sometime, exec shell file slowly.
we have test shell script,it just test hostname for 1000 times.
In 48C50G Mac OS
In 4C50G Mac OS
And this is my laucher scirpt
@sickcodes commented on GitHub (Jul 11, 2022):
Thank you for this 😁
This is good except this will use CPU