Click here to Skip to main content
15,887,476 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can i create a new bitmap file? Pin
lowiq29-Apr-04 3:42
lowiq29-Apr-04 3:42 
AnswerRe: how can i create a new bitmap file? Pin
Heath Stewart29-Apr-04 3:44
protectorHeath Stewart29-Apr-04 3:44 
GeneralPerformance Issues Pin
Member 105947128-Apr-04 19:59
Member 105947128-Apr-04 19:59 
GeneralRe: Performance Issues Pin
Meysam Mahfouzi28-Apr-04 20:39
Meysam Mahfouzi28-Apr-04 20:39 
GeneralRe: Performance Issues Pin
Heath Stewart29-Apr-04 3:40
protectorHeath Stewart29-Apr-04 3:40 
GeneralRe: Performance Issues Pin
Jeff Varszegi29-Apr-04 4:30
professionalJeff Varszegi29-Apr-04 4:30 
GeneralRe: Performance Issues Pin
Heath Stewart29-Apr-04 4:42
protectorHeath Stewart29-Apr-04 4:42 
GeneralRe: Performance Issues Pin
Jeff Varszegi29-Apr-04 4:53
professionalJeff Varszegi29-Apr-04 4: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 18:45
Member 94012528-Apr-04 18:45 
GeneralRe: A question about TabletPC SDK Pin
Heath Stewart29-Apr-04 3:38
protectorHeath Stewart29-Apr-04 3:38 
GeneralDeloyment Question Pin
Larry J. Siddens28-Apr-04 16:19
Larry J. Siddens28-Apr-04 16:19 
GeneralRe: Deloyment Question Pin
Tarakeshwar28-Apr-04 18:27
Tarakeshwar28-Apr-04 18:27 
GeneralRe: Deloyment Question Pin
Heath Stewart29-Apr-04 3:32
protectorHeath Stewart29-Apr-04 3:32 
GeneralRe: Deloyment Question Pin
Heath Stewart29-Apr-04 3:37
protectorHeath Stewart29-Apr-04 3:37 
GeneralSelfish LOCK! Pin
CiVerDream28-Apr-04 14:20
CiVerDream28-Apr-04 14:20 
GeneralRe: Selfish LOCK! Pin
Jeff Varszegi28-Apr-04 14:52
professionalJeff Varszegi28-Apr-04 14:52 
GeneralRe: Selfish LOCK! Pin
Heath Stewart29-Apr-04 3:32
protectorHeath Stewart29-Apr-04 3:32 
GeneralRe: Selfish LOCK! Pin
scadaguy28-Apr-04 15:37
scadaguy28-Apr-04 15:37 
Generalcrystal report export to excel Pin
econnor28-Apr-04 11:58
econnor28-Apr-04 11:58 
GeneralRe: crystal report export to excel Pin
Heath Stewart28-Apr-04 12:47
protectorHeath Stewart28-Apr-04 12:47 
GeneralAbout ArrayList. Help! Pin
wk_vigorous28-Apr-04 11:52
wk_vigorous28-Apr-04 11:52 
GeneralRe: About ArrayList. Help! Pin
Christian Graus28-Apr-04 12:00
protectorChristian Graus28-Apr-04 12:00 
GeneralRe: About ArrayList. Help! Pin
Colin Angus Mackay28-Apr-04 12:29
Colin Angus Mackay28-Apr-04 12:29 
GeneralRe: About ArrayList. Help! Pin
Jeff Varszegi28-Apr-04 12:44
professionalJeff Varszegi28-Apr-04 12:44 
GeneralRe: About ArrayList. Help! Pin
wk_vigorous29-Apr-04 0:43
wk_vigorous29-Apr-04 0: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.