473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

using the ' this. ' keyword. any small performance hit?

If source contains lots of this. statements, does this incur any kind of
minor performance hit, I'd imagine it does as it's causing a check to be
performed?

Thanks

Nov 16 '05 #1
3 1979
Guranteed... No at all........

Nirosh.

"Matt Swift" <ma**********@deletethisbitplshotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If source contains lots of this. statements, does this incur any kind of
minor performance hit, I'd imagine it does as it's causing a check to be
performed?

Thanks

Nov 16 '05 #2
Matt Swift <ma**********@deletethisbitplshotmail.com> wrote:
If source contains lots of this. statements, does this incur any kind of
minor performance hit, I'd imagine it does as it's causing a check to be
performed?


No - any statement where you're implicitly using "this." is exactly the
same as the statement with it included explicitly.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3
Additionally ... why to depend on some one else..

Open up a console app..
write two method.. and do some updates to a variable using 'this' and
without using 'this'..

eg
private int i = 0;
private void checkthis()
{
this.i ++;
}

private void checknothis()
{
i++;
}

Compile this and check the IL... using ildasm.exe

You will see that both the IL are indentical which guranteed that there is
no performance cost at all...

In addition...

if (condition)
{
line
}

if (condition)
line

also don't have any difference..

Nirosh..

"Champika Nirosh" <te**@test.lk> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
Guranteed... No at all........

Nirosh.

"Matt Swift" <ma**********@deletethisbitplshotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If source contains lots of this. statements, does this incur any kind of
minor performance hit, I'd imagine it does as it's causing a check to be
performed?

Thanks


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Mehul Patel | last post by:
Our .Net team have been pondering about using keyword. We are using streams FileStream and BufferedStream. We use using keyword at FileStream, and not BufferedStream which wraps FileStream. So...
65
by: Spiros Bousbouras | last post by:
Has anyone found that declaring variables register affected speed of execution ? If yes on what hardware and around which year ?
6
by: Arjen | last post by:
Hi, Form a performance perspective, is it wise to use the ref statement as much as possible? Thanks! Arjen
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.