I have the below snippet which takes a long time to run as the data increase.
OrderEntityColection is a List and samplePriceList is a List
OrderEntityColection = 30k trades samplePriceList = 1million prices
Takes easily 10-15 minute to finish or more
I have tested this with 1500 orders and 300k prices but it takes around 40-50 seconds as well and as the orders increase so do prices and even takes longer
Can you see how i can improve this. I have alreadyy cut it down to these numbers before in hand from a big set.
MarketId = int Audit = string
foreach (var tradeEntity in OrderEntityColection) { Parallel.ForEach(samplePriceList,new ParallelOptions {MaxDegreeOfParallelism = 8}, (price) => { if (price.MarketId == tradeEntity.MarketId) { if (tradeEntity.InstructionPriceAuditId == price.Audit) { // OrderExportColection.Enqueue(tradeEntity); count++; } } }); }
count++and threaded code.count? This is critically important.