[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] Is the speed of array index checking same as string compariso
From: |
Peng Yu |
Subject: |
[bug-gawk] Is the speed of array index checking same as string comparison? |
Date: |
Mon, 26 Nov 2018 04:02:38 -0600 |
Hi,
In the following example, it shows that the performance of array index
checking is same as string comparison. Is this conclusion always true?
Thanks.
$ time awk ' BEGIN {d["NA"]=1; for(i=1;i<=100000000;++i) ("NA" in d) }'
real 0m7.259s
user 0m7.024s
sys 0m0.070s
$ time awk ' BEGIN {x="NA"; for(i=1;i<=100000000;++i) x=="NA" }'
real 0m7.214s
user 0m6.970s
sys 0m0.066s
--
Regards,
Peng
- [bug-gawk] Is the speed of array index checking same as string comparison?,
Peng Yu <=