[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looping through an array with FOR EACH


Il 16/01/26 15:55, Brian G ha scritto:
Out of interest to see just how bad time wise using for each was, I put together a little test and was quite surprised by the result:

Ranking of each type of iteration by time

1       For each hybrid Time= 0.758384959, Total=9000003 0.758384959073737
2       Index only      Time= 0.837044355, total=9000003 0.83704435499385
3       for each only   Time= 1.282145344, Total=9000003 1.28214534395374

The short program is below.
It look like a combination of both types together depending on the array structure is best!


Hi Brian,

On my over 5-year-old PC (which I built myself 🤪 ), these are the results of your test:

Ranking of each type by time
1 For each hybrid Time= 0,461964985, Total=9000003 0,461964984999213 2 Index only Time= 0,467335708, total=9000003 0,467335707999155 3 for each only Time= 0,811512829, Total=9000003 0,811512829001003

Regards
Gianluigi


Follow-Ups:
Re: Looping through an array with FOR EACHGianluigi <gradobag@xxxxxxxxxxx>
References:
Looping through an array with FOR EACHGianluigi <gradobag@xxxxxxxxxxx>
Re: Looping through an array with FOR EACHBB <adamnt42@xxxxxxxxx>
Re: Looping through an array with FOR EACHGianluigi <gradobag@xxxxxxxxxxx>
Re: Looping through an array with FOR EACHBrian G <brian@xxxxxxxxxxxxxxxx>
Re: Looping through an array with FOR EACHGianluigi <gradobag@xxxxxxxxxxx>
Re: Looping through an array with FOR EACHBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Looping through an array with FOR EACHGianluigi <gradobag@xxxxxxxxxxx>
Re: Looping through an array with FOR EACHBrian G <brian@xxxxxxxxxxxxxxxx>
Re: Looping through an array with FOR EACHGianluigi <gradobag@xxxxxxxxxxx>
Re: Looping through an array with FOR EACHBruce Steers <bsteers4@xxxxxxxxx>
Re: Looping through an array with FOR EACHBrian G <brian@xxxxxxxxxxxxxxxx>