Monday 15 July 2013

Do goto statements in C and assembly break locality of reference thereby decreasing performance? -


I wrote a program in C that selects random words in a txt file format from a book and uses goto One by one prints statement When I run the program, it takes about 2 to 3 minutes to start running. Could it be that the Goto details break the field of reference and there is considerable decrease in performance? Apart from this, jmp in the Assembly also acts as a break away from the context of Goto.

This is a very unclear question. Whether or not the Gotos area may be impaired, it depends on the case. But even when it holds, it is not necessarily bad that it is. For this case, you have to post some code. Take a look at these 2 instances:

Case 1:

 For  (int i = 0; i  

Case 2:

  int flag = 0; For (int i = 0; i  " Key " on the last position of the array. 


No comments:

Post a Comment