Click here to Skip to main content
15,916,835 members
Home / Discussions / C#
   

C#

 
GeneralRe: Static Arraylist? Pin
SherKar2-Apr-04 6:41
SherKar2-Apr-04 6:41 
AnswerRe: Static Arraylist? Pin
Heath Stewart2-Apr-04 9:55
protectorHeath Stewart2-Apr-04 9:55 
Generaltracing keystrokes using c# Pin
amal_pro831-Apr-04 21:14
amal_pro831-Apr-04 21:14 
GeneralC# Keystroke logger? Pin
Anonymous1-Apr-04 21:58
Anonymous1-Apr-04 21:58 
GeneralRe: tracing keystrokes using c# Pin
Dave Kreskowiak2-Apr-04 4:27
mveDave Kreskowiak2-Apr-04 4:27 
Generalproblem using CommandBarComboBox in Outlook Add Ins Pin
naresh_pandey131-Apr-04 21:00
naresh_pandey131-Apr-04 21:00 
GeneralSetup Project Pin
DucLinh1-Apr-04 20:29
DucLinh1-Apr-04 20:29 
GeneralRe: Setup Project Pin
Heath Stewart2-Apr-04 10:04
protectorHeath Stewart2-Apr-04 10:04 
GeneralRe: Setup Project Pin
Demian Panello13-Apr-04 4:03
Demian Panello13-Apr-04 4:03 
GeneralDataGrid Pin
DucLinh1-Apr-04 20:12
DucLinh1-Apr-04 20:12 
GeneralRe: DataGrid Pin
benqazou2-Apr-04 5:46
benqazou2-Apr-04 5:46 
Generaldatatype check Pin
Anonymous1-Apr-04 19:01
Anonymous1-Apr-04 19:01 
GeneralRe: datatype check Pin
Andy Wieberneit1-Apr-04 20:19
Andy Wieberneit1-Apr-04 20:19 
GeneralRe: datatype check Pin
Anonymous2-Apr-04 2:21
Anonymous2-Apr-04 2:21 
GeneralOptimization of C# code!! Pin
abc8761-Apr-04 18:15
abc8761-Apr-04 18:15 
GeneralRe: Optimization of C# code!! Pin
Tristan Rhodes1-Apr-04 20:02
Tristan Rhodes1-Apr-04 20:02 
Why not use a local color variable, rather than looking the color up for each iteration?

<br />
Color currColor = image.pixel[x,y].GetColor();<br />
<br />
//Save on looking up pixel location repeatedly<br />
if( ObjHash.ContainsKey(currColor) )<br />
{<br />
int val= (int)ObjHash[currColor];<br />
ObjHash[currColor]=++val;<br />
test=false;<br />
}<br />
else //Remove an If test<br />
{<br />
ObjHash.Add(currColor),1);<br />
list.Add(currColor);<br />
count++;<br />
} // ending if (test)<br />
<br />


On top of that, you could try managing your arraylist and hashtable size. As enlarging a hashtable or Arraylist is a large overhead, and you are doing 6,930,000 loops, it might be worth setting the size of your arraylist and hash table to AL.Size + 1000; when it's full. Then trim it after the loops.

Why are you swapping the arraylists at the end? This could take a while if you have a few thousand entries. Why not trim the origional one, and return that?

Cata
GeneralRe: Optimization of C# code!! Pin
Daniel Turini1-Apr-04 20:35
Daniel Turini1-Apr-04 20:35 
GeneralRe: Optimization of C# code!! Pin
Kastellanos Nikos1-Apr-04 23:09
Kastellanos Nikos1-Apr-04 23:09 
GeneralRe: Optimization of C# code!! Pin
Kastellanos Nikos1-Apr-04 23:24
Kastellanos Nikos1-Apr-04 23:24 
GeneralA question of a Game Pin
lajiyo1-Apr-04 15:36
lajiyo1-Apr-04 15:36 
GeneralRe: A question of a Game Pin
Christian Graus1-Apr-04 15:53
protectorChristian Graus1-Apr-04 15:53 
GeneralRe: A question of a Game Pin
CWIZO2-Apr-04 2:42
CWIZO2-Apr-04 2:42 
GeneralRe: A question of a Game Pin
lajiyo2-Apr-04 23:01
lajiyo2-Apr-04 23:01 
GeneraldataSet, combobox Pin
DougW481-Apr-04 14:53
DougW481-Apr-04 14:53 
GeneralRe: dataSet, combobox Pin
Anonymous1-Apr-04 16:47
Anonymous1-Apr-04 16:47 

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.