Multi-threading Efficiency
-
Can anyone please tell me what would be the most efficient way to calculate data. I have to calculate 10000 items with 1000 algorithms each. 1. Have 10 different groups of data 100 algorithms each in various parts of my program, where it locks and unlocks the DataTable when storing. or 2. Calculate 1000 algorithms all at once, locking and unlocking the DataTable only once. Because 2 is a larger set of data to calculate other processes might have to wait more. However 1 locks and unlocks many more times slowing down the process. What is considered the best practice or rule to follow. Thanks in advance, Michael
-
Can anyone please tell me what would be the most efficient way to calculate data. I have to calculate 10000 items with 1000 algorithms each. 1. Have 10 different groups of data 100 algorithms each in various parts of my program, where it locks and unlocks the DataTable when storing. or 2. Calculate 1000 algorithms all at once, locking and unlocking the DataTable only once. Because 2 is a larger set of data to calculate other processes might have to wait more. However 1 locks and unlocks many more times slowing down the process. What is considered the best practice or rule to follow. Thanks in advance, Michael
Given a choice I would do this in a stored procedure in the database.
Never underestimate the power of human stupidity RAH
-
Given a choice I would do this in a stored procedure in the database.
Never underestimate the power of human stupidity RAH
-
Can anyone please tell me what would be the most efficient way to calculate data. I have to calculate 10000 items with 1000 algorithms each. 1. Have 10 different groups of data 100 algorithms each in various parts of my program, where it locks and unlocks the DataTable when storing. or 2. Calculate 1000 algorithms all at once, locking and unlocking the DataTable only once. Because 2 is a larger set of data to calculate other processes might have to wait more. However 1 locks and unlocks many more times slowing down the process. What is considered the best practice or rule to follow. Thanks in advance, Michael
There's a lot of context missing here that means we can't advise you on the best approach. Do the algorithms work on the same data out of the DataTable? Do they each work on a different row? Do the effects of their calculations update the DataTable? Is this DataTable loaded once and then readonly for the lifetime of the application?
This space for rent
-
Are there any other constraints you did not tell us about? If you don't mind the fact that you could loose all work that has already been done, then you calculate all results in memory and write them in one go. Otherwise, you'd best be working in batches.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)