[Pharo-dev] Re: Array sum. is very slow

2022-01-09 Thread Nicolas Anquetil
On Sun, 2022-01-09 at 12:05 +0100, Nicolas Anquetil wrote: > > Definitly not easy to do benchmarking > I got these strange results: > > n := 1000. > floatArray := Array new: n. > > Time millisecondsToRun: [ floatArray doWithIndex: [:each :idx | > floatArray at: idx put: Random new ] ]. >

[Pharo-dev] Re: Array sum. is very slow

2022-01-09 Thread Nicolas Anquetil
Definitly not easy to do benchmarking I got these strange results: n := 1000. floatArray := Array new: n. Time millisecondsToRun: [ floatArray doWithIndex: [:each :idx | floatArray at: idx put: Random new ] ]. "-> 2871" Time millisecondsToRun: [ floatArray doWithIndex: [:each :idx |

[Pharo-dev] Re: [lse-consortium-eng] Array sum. is very slow

2022-01-09 Thread Guillermo Polito
Yet, be careful, that way of benchmarking will have a lot of variation and noise. Remember there is an OS, other apps open, even the CPU getting hot/cold can introduce performance differences... At least, that snippet should be run so many times (I do 100 iterations in general), and the averages

[Pharo-dev] Re: Array sum. is very slow

2022-01-09 Thread Stéphane Ducasse
On my machine so this is the same. SQ5.3 Test with 1000 elements Original #sum -> Time: 196 milliseconds, Total: 5.001448710680429e6 Naive #sum -> Time: 152 milliseconds, Total: 5.001448710680429e6 Inject #sum -> Time: 143 milliseconds, Total: 5.001448710680429e6 > On 8 Jan 2022, at