[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Can `declare -i` increase the performance of integer arithme
From: |
Peng Yu |
Subject: |
[Help-bash] Can `declare -i` increase the performance of integer arithmetic? |
Date: |
Sun, 21 Jan 2018 13:10:31 -0600 |
Hi,
I tried `declare -i`. But it doesn't see to improve performance. Is it
supposed to improve the performance? Thanks.
$ time ./script2.sh; time ./script.sh
real 0m6.764s
user 0m6.733s
sys 0m0.015s
real 0m6.810s
user 0m6.782s
sys 0m0.010s
==> script.sh <==
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
declare -i i
for ((i=0;i<1000000;++i))
do
:
done
==> script2.sh <==
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
for ((i=0;i<1000000;++i))
do
:
done
--
Regards,
Peng
- [Help-bash] Can `declare -i` increase the performance of integer arithmetic?,
Peng Yu <=