Click here to Skip to main content
15,845,196 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can i create a new bitmap file? Pin
lowiq29-Apr-04 4:42
lowiq29-Apr-04 4:42 
AnswerRe: how can i create a new bitmap file? Pin
Heath Stewart29-Apr-04 4:44
protectorHeath Stewart29-Apr-04 4:44 
GeneralPerformance Issues Pin
Member 105947128-Apr-04 20:59
Member 105947128-Apr-04 20:59 
GeneralRe: Performance Issues Pin
Meysam Mahfouzi28-Apr-04 21:39
Meysam Mahfouzi28-Apr-04 21:39 
GeneralRe: Performance Issues Pin
Heath Stewart29-Apr-04 4:40
protectorHeath Stewart29-Apr-04 4:40 
GeneralRe: Performance Issues Pin
Jeff Varszegi29-Apr-04 5:30
professionalJeff Varszegi29-Apr-04 5:30 
GeneralRe: Performance Issues Pin
Heath Stewart29-Apr-04 5:42
protectorHeath Stewart29-Apr-04 5:42 
GeneralRe: Performance Issues Pin
Jeff Varszegi29-Apr-04 5:53
professionalJeff Varszegi29-Apr-04 5:53 
Sheesh, you're absolutely right. Thanks-- I thought those numbers looked suspiciously close, but I chalked it up to running in Debug mode, and I never realized that Guid is a struct! I ran this code:

<br />
            long startTime, endTime;<br />
            int loopCount = 10000000;<br />
            <br />
            string s = "";<br />
            string s2 = s;<br />
            object o = s;<br />
            object[] objectArray = {s};<br />
            string[] stringArray = {s};<br />
<br />
            startTime = DateTime.Now.Ticks;<br />
            for(int x = 0; x < loopCount; x++) {<br />
                s = (string)objectArray[0];<br />
                s = (string)objectArray[0];<br />
                s = (string)objectArray[0];<br />
            }<br />
            endTime = DateTime.Now.Ticks;<br />
            Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (accessing array of objects)");<br />
            <br />
            startTime = DateTime.Now.Ticks;<br />
            for(int x = 0; x < loopCount; x++) {<br />
                s = stringArray[0];<br />
                s = stringArray[0];<br />
                s = stringArray[0];<br />
           }<br />
            endTime = DateTime.Now.Ticks;<br />
            Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (accessing array of strings)");<br />
            <br />
            startTime = DateTime.Now.Ticks;<br />
            for(int x = 0; x < loopCount; x++) {<br />
                s = (string)o;<br />
                s = (string)o;<br />
                s = (string)o;<br />
            }<br />
            endTime = DateTime.Now.Ticks;<br />
            Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (assigning string from object w/ cast)");<br />
            <br />
            startTime = DateTime.Now.Ticks;<br />
            for(int x = 0; x < loopCount; x++) {<br />
                s = s2;<br />
                s = s2;<br />
                s = s2;<br />
            }<br />
            endTime = DateTime.Now.Ticks;<br />
            Console.WriteLine(((endTime - startTime) / 10) + " microseconds total (assigning string from string)");            <br />
            <br />
<br />
            Environment.Exit(0);<br />


and got this output:
234375 microseconds total (accessing array of objects)
62500 microseconds total (accessing array of strings)
187500 microseconds total (assigning string from object w/ cast)
46875 microseconds total (assigning string from string)


Casting introduces a big performance whack in Java programs, a little less in .NET ones in my experience, but still very significant.

Regards,

Jeff Varszegi

EEEP!
GeneralA question about TabletPC SDK Pin
Member 94012528-Apr-04 19:45
Member 94012528-Apr-04 19:45 
GeneralRe: A question about TabletPC SDK Pin
Heath Stewart29-Apr-04 4:38
protectorHeath Stewart29-Apr-04 4:38 
GeneralDeloyment Question Pin
Larry J. Siddens28-Apr-04 17:19
Larry J. Siddens28-Apr-04 17:19 
GeneralRe: Deloyment Question Pin
Tarakeshwar28-Apr-04 19:27
Tarakeshwar28-Apr-04 19:27 
GeneralRe: Deloyment Question Pin
Heath Stewart29-Apr-04 4:32
protectorHeath Stewart29-Apr-04 4:32 
GeneralRe: Deloyment Question Pin
Heath Stewart29-Apr-04 4:37
protectorHeath Stewart29-Apr-04 4:37 
GeneralSelfish LOCK! Pin
CiVerDream28-Apr-04 15:20
CiVerDream28-Apr-04 15:20 
GeneralRe: Selfish LOCK! Pin
Jeff Varszegi28-Apr-04 15:52
professionalJeff Varszegi28-Apr-04 15:52 
GeneralRe: Selfish LOCK! Pin
Heath Stewart29-Apr-04 4:32
protectorHeath Stewart29-Apr-04 4:32 
GeneralRe: Selfish LOCK! Pin
scadaguy28-Apr-04 16:37
scadaguy28-Apr-04 16:37 
Generalcrystal report export to excel Pin
econnor28-Apr-04 12:58
econnor28-Apr-04 12:58 
GeneralRe: crystal report export to excel Pin
Heath Stewart28-Apr-04 13:47
protectorHeath Stewart28-Apr-04 13:47 
GeneralAbout ArrayList. Help! Pin
wk_vigorous28-Apr-04 12:52
wk_vigorous28-Apr-04 12:52 
GeneralRe: About ArrayList. Help! Pin
Christian Graus28-Apr-04 13:00
protectorChristian Graus28-Apr-04 13:00 
GeneralRe: About ArrayList. Help! Pin
Colin Angus Mackay28-Apr-04 13:29
Colin Angus Mackay28-Apr-04 13:29 
GeneralRe: About ArrayList. Help! Pin
Jeff Varszegi28-Apr-04 13:44
professionalJeff Varszegi28-Apr-04 13:44 
GeneralRe: About ArrayList. Help! Pin
wk_vigorous29-Apr-04 1:43
wk_vigorous29-Apr-04 1:43 

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.