AsParallel

Posted: 7 months ago Quote
Of the following, c is (by far) the fastest


        Dim a = (From X In z.AsParallel
                 Order By X
                 Group By X Into Xs = Group
                 Select X, Xs).ToArray

        Dim b = (From X In z.AsParallel
                 Group By X Into Xs = Group
                 Order By X
                 Select X, Xs).ToArray

        Dim c = (From X In z.AsParallel
                 Group By X Into Xs = Group
                 Select X, Xs).OrderBy(Function(f) f.X).ToArray


that's because it's harder to order the array across multiple threads than to just do the work by thread and sort it on the main thread when completed.
do not worry, the robots are taking control for your safety
Posted: 7 months ago Quote
by the way, if you plan on iterating thru your linq query, convert it to an array first (via ToArray), otherwise it seems to do the query for each iteration, which is horribly slow on large data sets. it's also a good idea to only use a single parralell array (via AsParallel) in the linq query as multiple parallel arrays just make it slower (because i think more cross thread communication)
do not worry, the robots are taking control for your safety
Posted: 7 months ago Quote
I remember reading about this a while back.  This is extremely useful to know for optimizing performace.

Especially on a 3CX system.  You can't have a bunch of threads suddenly eating up processor power for significant periods of time.  It may start to affect calls on the system.
Shahzad Qureshi
SWS Development, LLC
(www.UtahVoIPStore.com)
Custom 3CX Integration