mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
The linear search in the nested loop over SCSI devices and over the indexed array is still time consuming. So replace the indexed array with an associative array. Build the array once outside of the nested loop by using pathname expansion and extracting key and value from each item. Within the SCSI device loop, an array entry is removed by means of the key without linear search. This commit is separate from the previous one so it is possible to revert this one in case associative arrays would not be available and still get the speed improvement from the indexed array in the previous commit. Before: $ time ~/git/s390-tools/zconf/lszfcp -De | wc -l 1036 real 0m17.605s user 0m17.159s sys 0m0.308s After: $ time ~/git/s390-tools/zconf/lszfcp -De | wc -l 1036 real 0m0.207s user 0m0.175s sys 0m0.032s Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Steffen Maier <maier@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>