Click here to Skip to main content
15,923,197 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralIf I get FileURL, Every thing is OK. Pin
lewislewis_lewis14-Jun-05 8:01
lewislewis_lewis14-Jun-05 8:01 
GeneralRe: If I get FileURL, Every thing is OK. Pin
David Crow14-Jun-05 8:03
David Crow14-Jun-05 8:03 
GeneralNo work using URL Pin
lewislewis_lewis14-Jun-05 8:50
lewislewis_lewis14-Jun-05 8:50 
GeneralRe: No work using URL Pin
David Crow14-Jun-05 8:54
David Crow14-Jun-05 8:54 
GeneralRe: No work using URL Pin
lewislewis_lewis14-Jun-05 9:06
lewislewis_lewis14-Jun-05 9:06 
GeneralRe: No work using URL Pin
David Crow14-Jun-05 9:14
David Crow14-Jun-05 9:14 
Generalnot empty Pin
lewislewis_lewis14-Jun-05 9:26
lewislewis_lewis14-Jun-05 9:26 
GeneralRe: not empty Pin
David Crow14-Jun-05 9:31
David Crow14-Jun-05 9:31 
GeneralSory copy wrong. FTP (MS explore ) is OK Pin
lewislewis_lewis14-Jun-05 9:41
lewislewis_lewis14-Jun-05 9:41 
GeneralRe: Sory copy wrong. FTP (MS explore ) is OK Pin
David Crow14-Jun-05 9:56
David Crow14-Jun-05 9:56 
Generalerror code is 12003 Pin
lewislewis_lewis14-Jun-05 10:21
lewislewis_lewis14-Jun-05 10:21 
GeneralRe: error code is 12003 Pin
David Crow14-Jun-05 10:27
David Crow14-Jun-05 10:27 
GeneralHow is go on? Pin
lewislewis_lewis14-Jun-05 10:37
lewislewis_lewis14-Jun-05 10:37 
GeneralRe: How is go on? Pin
David Crow14-Jun-05 11:02
David Crow14-Jun-05 11:02 
GeneralTest Site: Pin
lewislewis_lewis14-Jun-05 11:11
lewislewis_lewis14-Jun-05 11:11 
GeneralRe: Test Site: Pin
David Crow15-Jun-05 3:35
David Crow15-Jun-05 3:35 
GeneralThanks You every much,. but have somequestion? Pin
lewislewis_lewis15-Jun-05 5:25
lewislewis_lewis15-Jun-05 5:25 
GeneralDisabling toolbutton Pin
laiju14-Jun-05 0:20
laiju14-Jun-05 0:20 
GeneralRe: Disabling toolbutton Pin
David Crow14-Jun-05 1:33
David Crow14-Jun-05 1:33 
GeneralRe: Disabling toolbutton Pin
laiju17-Jun-05 0:32
laiju17-Jun-05 0:32 
GeneralA very small performance issue in C++ Pin
Jagadeesh VN14-Jun-05 2:27
Jagadeesh VN14-Jun-05 2:27 
GeneralRe: A very small performance issue in C++ Pin
Dezhi Zhao14-Jun-05 3:32
Dezhi Zhao14-Jun-05 3:32 
GeneralRe: A very small performance issue in C++ Pin
Bob Stanneveld14-Jun-05 1:28
Bob Stanneveld14-Jun-05 1:28 
Hello,

Jagadeesh VN wrote:
Inside the main(), I created 10000 objects of the structure and assigned it to a pointer variable.

myStruct* obj = new myStruct[10001];<br />
memset( obj,0,sizeof(myStruct) * 10005);


Here you actually create 10.001 structs and initialize 10.005! This is very wrong!


Jagadeesh VN wrote:
for( long l=0;l<100000000;l++)<br />
{<br />
obj++;<br />
l1 += obj->index; //just an addition so that compiler wont remove the previous line<br />
<br />
if( i % 10000 == 0 ){<br />
obj = obj1;<br />
l1 = 0; //reseting the values;<br />
}


A couple of questions on this piece of code:
<list>
  • Why the dummy addition (l1 += obj->index;) The compiler won't remove the line, since you use the object further down your code!
  • Why such a long loop?
  • Your loop does nothing usefull, why?
    To get to an answer, I honestly don't think that the long loop is your problem. I think the problem lies with memset(). Let me explain: your execution time drops liniear with the size of the struct. So the size of the array decreases also liniear. (You halve the size of the stuct, so the size of the array is also halved.) So the amount of memory that memset() has to fill is also halved!

    Besides that, your loop executes 100 million times! Don't expect that to finish in a few ms..



    Behind every great black man...
                ... is the police. - Conspiracy brother


    Blog[^]

  • Generalcopy jpg to clipboard Pin
    Stirfie14-Jun-05 2:08
    Stirfie14-Jun-05 2:08 
    GeneralRe: copy jpg to clipboard Pin
    David Crow14-Jun-05 3:12
    David Crow14-Jun-05 3:12 

    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.