Click here to Skip to main content
15,885,952 members
Home / Discussions / C#
   

C#

 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 21:39
Som Shekhar16-Dec-09 21:39 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen16-Dec-09 21:53
professionalEddy Vluggen16-Dec-09 21:53 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 21:56
Som Shekhar16-Dec-09 21:56 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen17-Dec-09 1:53
professionalEddy Vluggen17-Dec-09 1:53 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar17-Dec-09 2:40
Som Shekhar17-Dec-09 2:40 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen17-Dec-09 9:34
professionalEddy Vluggen17-Dec-09 9:34 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar17-Dec-09 10:12
Som Shekhar17-Dec-09 10:12 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen17-Dec-09 13:13
professionalEddy Vluggen17-Dec-09 13:13 
Som Shekhar wrote:
Coding is easy.


I'm looking at a buglist right now which tells me that it's not as easy as English.


Som Shekhar wrote:
As I mentioned, The trouble comes when multiple of such calculations happen together. I am currently working on multi-threading of different instances. Atleast to save some more time.


Have you seen the article[^] on the AForge.Parallel.For-class? It might help in building a prototype to measure against Smile | :)


Som Shekhar wrote:
In this problem, calculation of fluid height is needed. There are multiple fluid columns and many such tubes. With drag and drop functionality


True, but it would also make an impressive interface Cool | :cool:


Som Shekhar wrote:
Usually working with already implemented concepts is always better. Consider using a dictionary vs. implemented List with key.


I'd try to mirror the concept of a database in-memory; creating a list of the records, and the equivalent of an index. IQueryable[^] springs into mind.


Som Shekhar wrote:
You would be surprised that i have come across such situation more than 4-5 times already while designing my applications. I usually work on disconnected database system and speed is a primary concern in loading and saving data.

I initially worked with datatables which worked fine when my application was young. As it grew older, datatables are damn slow. I moved to dictionary. So far, they are fine. Even today, i experience a max lag of 0.5-0.6 sec on a drag drop operation which isn't too much to worry about.



This post[^] confirms that although databases manipulate data very fast, your results are faster.


Som Shekhar wrote:
By multi-threading, i hope to reduce it to around 0.1-0.2 which should be manageable. But it is good to keep up with concepts.

Usually a parallel solutions does wonders and thats what I was hoping here.


One could consider multiple ways to optimize, and I'm sure that would be some creative ways that'd get posted to do so. Using the Parallel.For class to lookup all the elements could be a good start.

Another, perhaps better implementation yet, would then be a readonly list, to describe a table like presented below. Instead of writing a null, your could launch a short lived thread to calculate it's distance to a yougest version in the list, that disctince gives you the index of the value that it actually stands for. This should be done when you load the data; you'd have to process it a bit of a time decoding it, but that also shortens the amount needed to retrieve data from that list. This would be an optimization on the readprocess, as you can forget about fetching it at all if it's really there. Moving this particular task to the method that's doing the initalization, lookups would be faster. The initialization-routine could also be (ab)used to dynamically enrich your data, if that would be required.

You could then do parallel lookups, each lookup falling back on it's PK - A Perhaps a HashTable<key, record="" [as="" struct!]="">. You'd would then already be pointing at all the correct values, for all correct columns, without having to worry for corruption. That's as long as the read is readonly and easily accessible by threads.

I'm of to bed, this kept going through my head all the time. I wonder if I'm now gonna dream about it?

I are Troll Suspicious | :suss:

GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar18-Dec-09 18:59
Som Shekhar18-Dec-09 18:59 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen19-Dec-09 0:48
professionalEddy Vluggen19-Dec-09 0:48 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar19-Dec-09 2:28
Som Shekhar19-Dec-09 2:28 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen19-Dec-09 9:41
professionalEddy Vluggen19-Dec-09 9:41 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar19-Dec-09 20:16
Som Shekhar19-Dec-09 20:16 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen20-Dec-09 5:54
professionalEddy Vluggen20-Dec-09 5:54 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar20-Dec-09 18:22
Som Shekhar20-Dec-09 18:22 
AnswerRe: Continued Values Collection/List/Dictionary [modified] Pin
Gideon Engelberth16-Dec-09 15:05
Gideon Engelberth16-Dec-09 15:05 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 19:15
Som Shekhar16-Dec-09 19:15 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Gideon Engelberth17-Dec-09 3:31
Gideon Engelberth17-Dec-09 3:31 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar17-Dec-09 3:42
Som Shekhar17-Dec-09 3:42 
AnswerRe: Continued Values Collection/List/Dictionary [modified] Pin
BillWoodruff16-Dec-09 16:55
professionalBillWoodruff16-Dec-09 16:55 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 19:17
Som Shekhar16-Dec-09 19:17 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 19:19
Som Shekhar16-Dec-09 19:19 
GeneralRe: Continued Values Collection/List/Dictionary Pin
BillWoodruff16-Dec-09 19:41
professionalBillWoodruff16-Dec-09 19:41 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar18-Dec-09 19:02
Som Shekhar18-Dec-09 19:02 
Questionproblem with the tcp connetion. Pin
prasadbuddhika16-Dec-09 6:24
prasadbuddhika16-Dec-09 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.