The timing on my problem using threads seems odd. The program with just the 
main thread (listing below) does the following:

  1. fills a large ref array with value 1 in the lower half and 2 in the upper 
half.



2\. calls proc sum, which sums the values of the ref array. For compiling I use 
`` nim c -d:release --threads:on sumArray2.nim `` the time values are: `real 
0m1.482s user 0m0.577s sys 0m0.905s`

When I use a thread for the proc sum (listing below), the time values are: 
`real 0m4.208s user 0m2.405s sys 0m1.805s`

When I divide up the work to 2 threads for the proc sum (listing below), the 
time values are: `real 0m6.833s user 0m4.307s sys 0m2.650s`

Am I doing something wrong?

Reply via email to