Is there any performance issue in it
-
Hi All, I have one doubt i have a data container class Applicant.i have created many objects of other classes like PersonalInfo,Employment..... etc in the constructor of applicant. Now the question is there any performace issue while using these 2 sentnces
string Address = applicantObject.PersonalInfo.Address;
Or should do in another wayPersonalInfo personalInfoObject=applicantObject.PersonalInfo; string Address=personalInfoObject.Address;
Is there any perforamance between 2 Address is a property it might have many properties Can any one give me the link where i can read performance issue for this typeThanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Hi All, I have one doubt i have a data container class Applicant.i have created many objects of other classes like PersonalInfo,Employment..... etc in the constructor of applicant. Now the question is there any performace issue while using these 2 sentnces
string Address = applicantObject.PersonalInfo.Address;
Or should do in another wayPersonalInfo personalInfoObject=applicantObject.PersonalInfo; string Address=personalInfoObject.Address;
Is there any perforamance between 2 Address is a property it might have many properties Can any one give me the link where i can read performance issue for this typeThanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
Option 2 creates another reference to a class, or another copy of a struct. Either way, this is not going to have a huge hit.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Hi All, I have one doubt i have a data container class Applicant.i have created many objects of other classes like PersonalInfo,Employment..... etc in the constructor of applicant. Now the question is there any performace issue while using these 2 sentnces
string Address = applicantObject.PersonalInfo.Address;
Or should do in another wayPersonalInfo personalInfoObject=applicantObject.PersonalInfo; string Address=personalInfoObject.Address;
Is there any perforamance between 2 Address is a property it might have many properties Can any one give me the link where i can read performance issue for this typeThanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
I don't think this would be a performance issue.
playing with bugs ) wrote:
string Address = applicantObject.PersonalInfo.Address;
This will create a memory space for address and store the value.
playing with bugs ) wrote:
PersonalInfo personalInfoObject=applicantObject.PersonalInfo; string Address=personalInfoObject.Address;
This will create another location on the stack and refer to the specified object. In this also new location for string would be created. This won't be a big performance issue.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Option 2 creates another reference to a class, or another copy of a struct. Either way, this is not going to have a huge hit.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Hi Chris, Thanks for reply, Here all are reference type(Class) so you are right option 2 creates pointer to same memory.
Christian Graus wrote:
Either way, this is not going to have a huge hit.
Is CLR is going to call these 2 sentences in same way ?
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
I don't think this would be a performance issue.
playing with bugs ) wrote:
string Address = applicantObject.PersonalInfo.Address;
This will create a memory space for address and store the value.
playing with bugs ) wrote:
PersonalInfo personalInfoObject=applicantObject.PersonalInfo; string Address=personalInfoObject.Address;
This will create another location on the stack and refer to the specified object. In this also new location for string would be created. This won't be a big performance issue.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
Hey Navaneeth !!!!! Thanks for you valuable comments. But if you see the how CLR going to call these 2 sentences i think that makes the difference
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Hey Navaneeth !!!!! Thanks for you valuable comments. But if you see the how CLR going to call these 2 sentences i think that makes the difference
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
playing with bugs ) wrote:
But if you see the how CLR going to call these 2 sentences i think that makes the difference
I am not getting how this can make a performance difference ? What made you to think so ?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
playing with bugs ) wrote:
But if you see the how CLR going to call these 2 sentences i think that makes the difference
I am not getting how this can make a performance difference ? What made you to think so ?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
Just wanted to know is there performace issue in it. i think you are right there is not much difference in both Thanks
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Just wanted to know is there performace issue in it. i think you are right there is not much difference in both Thanks
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
Although, if it makes any extra performance, it would be very less and negligible. Those two are two types of approach to the problem.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Hi All, I have one doubt i have a data container class Applicant.i have created many objects of other classes like PersonalInfo,Employment..... etc in the constructor of applicant. Now the question is there any performace issue while using these 2 sentnces
string Address = applicantObject.PersonalInfo.Address;
Or should do in another wayPersonalInfo personalInfoObject=applicantObject.PersonalInfo; string Address=personalInfoObject.Address;
Is there any perforamance between 2 Address is a property it might have many properties Can any one give me the link where i can read performance issue for this typeThanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
Choose whatever way is going to be the easiest to read. The performance differences will be negligible in the big picture, but if you 'pre-optimise' your code too much, you could go back to it in a years time and have no idea what you were trying to do... keep it simple.
-
Choose whatever way is going to be the easiest to read. The performance differences will be negligible in the big picture, but if you 'pre-optimise' your code too much, you could go back to it in a years time and have no idea what you were trying to do... keep it simple.
Very well said Paddy :)
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "