[Swift-user] Re: Swift app question

Jonathan Monette jon.monette at gmail.com
Wed Sep 8 21:40:03 CDT 2010


  Ok.  And like I said this was a dumbed down example.  I just needed to 
show a mappings and didn't want to use a fancy mapper.  In my code x 
will be a different value for each iteration.  Thanks though.  That 
clears things up.

On 9/8/10 9:37 PM, Mihael Hategan wrote:
> Theoretically since there is no dependency between m1, m2 and y, it
> should run right ahead. Practically each invocation will probably wait
> for values in years.
>
> But I have to ask. Why bother doing this for every year if, at least
> from your code, x would have the same value every time (i.e. there is no
> actual dependency on y)?
>
> Mihael
>
> On Wed, 2010-09-08 at 21:28 -0500, Jonathan Monette wrote:
>> This is what I meant.
>>
>> foreach y in years
>> {
>>       Month m1<"month1.txt">;
>>       Month m2<"month2.txt">;
>>
>>       Year x = calculate( m1, m2 );
>> }
>>
>> I know that threads will be created and each iteration for the foreach
>> loop will run in parallel.  What I am trying to understand is when is
>> the calculate app executed.  This is a very dumbed down example but I
>> want to know will x be mapped to the output of calculate once m1 and m2
>> are closed or is there a "barrier" that blocks until all threads have
>> finished mapping m1 and m2 before the apps are run in parallel?
>>
>> On 9/8/10 9:21 PM, Mihael Hategan wrote:
>>> foreach y in years
>>>>   >   {
>>>>   >             Month m1<   "month1.txt">;
>>>>   >             Month m2<"month2.txt">;
>>>>   >
>>>>   >             Year y = calculate( m1, m2 );
>>>>   >   }
>

-- 
Jon

Computers are incredibly fast, accurate, and stupid. Human beings are incredibly slow, inaccurate, and brilliant. Together they are powerful beyond imagination.
- Albert Einstein




More information about the Swift-user mailing list