目前我正在使用LocalReport.Render来创建9万条记录的PDF。使用正常的“for”循环,仅创建PDF需要大约4小时的时间。我尝试了许多选项。
Tried with Parallel. Foreach with and without setting MaxDegreeOfParallelism with different values. There are 2 processors in my system. With setting MaxDegreeOfParallelism(MDP) =4, it is taking the time as normal 'for' loop. I thought increasing MDP to 40 will speed up the process. But didn't get expected results since it took 900 minutes.
Used
var list=List<Thread ()>; foreach (var record in records) { var thread = new Thread (=> GeneratePDF()); thread.Start(); list.Add(thread); } foreach(var listThreads in thread){ listThreads. Join();
}
我需要使用Parallel.Foreach加快为90K条记录创建PDF的进程。更改代码的建议也可以接受。 非常感谢您的帮助。
谢谢