Windows Develop Bookmark and Share   
 index > Windows Forms General > performance issue
 

performance issue

Iam using hash table for loading data of about 100,000 rows from .cvs file and its getting about 3 sec to load the data if we are loading more data in different hashtables and checking key exists then takes more time so its becoming performance issue for us.

Ihave checked hashtable is fastest data structure if i am not wrong,please suggest how we can improve performce with different technique.

Regards

farjack  Friday, July 11, 2008 7:07 PM
.NET doesn't generate a very good hash code for structures. Be sure to override GetHashCode() and Equals(). With that many rows, you are probably also generating memory pressure and getting a lot of page faults. Use a diagnostic tool like SysInternals' ProcExp utility to diagnose.
nobugz  Tuesday, July 15, 2008 7:56 PM

How about using a DataTable? Or a Generic Dictionary

JohnGrove  Friday, July 11, 2008 7:25 PM

do you mean csv? and do you have any control when you save the files, or are you just loading them? because if you saved them in bytes instead of text it's definately more space efficient, and may be more time efficient.

ScottyDoesKnow  Friday, July 11, 2008 8:45 PM

Are you sure that reading it into a jagged array isn't faster? ReadAllLines and then Split on the comma. It depends upon what you are doing after you have the data in memory.

JohnWein  Friday, July 11, 2008 8:52 PM

Let's find out:

Code Snippet

Public Class Timing

Private startingTime As TimeSpan

Private duration As TimeSpan

Public Sub New()

startingTime = New TimeSpan(0)

duration = New TimeSpan(0)

End Sub

Public Sub StartTime()

GC.Collect()

GC.WaitForPendingFinalizers()

startingTime = Process.GetCurrentProcess.Threads(0).UserProcessorTime

End Sub

Public Sub StopTime()

duration = Process.GetCurrentProcess.Threads(0).UserProcessorTime

End Sub

Public ReadOnly Property Result() As TimeSpan

Get

Return duration

End Get

End Property

End Class

JohnGrove  Friday, July 11, 2008 9:03 PM
.NET doesn't generate a very good hash code for structures. Be sure to override GetHashCode() and Equals(). With that many rows, you are probably also generating memory pressure and getting a lot of page faults. Use a diagnostic tool like SysInternals' ProcExp utility to diagnose.
nobugz  Tuesday, July 15, 2008 7:56 PM

You can use google to search for other answers

Custom Search

More Threads

• Problem with big form
• VB2005: ?'s about Tab control and Namespaces
• Creating a non-rectangular window
• ToolMenuStrip Problem
• Problem of circular reference.
• DataGridView - combo box cell requires 3 click until drop down appears
• Creating report without using crystal
• Custom (Transparent/Shape) Control
• Always on top window...
• Using 2 buttons on form ... ?