kdlucas / byte-unixbench

Automatically exported from code.google.com/p/byte-unixbench
GNU General Public License v2.0
1.27k stars 323 forks source link

Use built-in arithmetic expansion feature to replace external expr to trigger tst.sh in parallel ASAP #84

Closed lipzhu closed 1 year ago

lipzhu commented 1 year ago

With the parallel/copy number grows, the cost percentage of expr $instance + 1 will increase exponentially due to the contention, this will impact the real workload tst.sh trigger speed in the while section.

gstrauss commented 1 year ago

Seems reasonable to loop and run tst.sh & more quickly in parallel.

I wonder if using seq would be even faster. for i in $(seq 1 $1); do /bin/sh "$UB_BINDIR/tst.sh" &; done

lipzhu commented 1 year ago

@gstrauss Thanks for your quick response, in my local test environment, the for seq loop is slower 8.2% than while with $(()). ./Run shell1 -c 160 run in below env:

1. Intel ICX server with 160 cpu
2. Kernel 6.0.0-rc6
3. ldd --version: ldd (GNU libc) 2.28
4. gcc --version: gcc (GCC) 8.5.0
5. sh --version: GNU bash, version 4.4.20(1)-release
6. ...
gstrauss commented 1 year ago

Ok. That's fine. I'll look at this more tomorrow.

BTW, in a non-scientific quick use of 'time', seq was ~15% faster on my 7-year-old laptop.

gstrauss commented 1 year ago

merged. thanks!