• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing variables.  RSS feed

 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello dudes,
Do u guys know the perf. difference between accessing a local variable described as a member in a class, and a variable that is defined in the parent class..
Lets say
Class B has a variable v1
and Class A extends B and has a variable v2
Would this v1= voo(); be slower then v2= voo();? both inside Class A
I don't have a clue about the byte code generated, nor memory represenatition of classes, so help will be very much appreciated.
Thanks a bunch!
[ May 03, 2004: Message edited by: Tonny Tssagovic ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The byte code wouldn't help anyway, since it gets compiled to platform specific machine code at runtime.
I don't have a clue about the specifics, either - but I am quite sure that the difference is so small that in 99.99999% of the cases, every second spend thinking about it is wasted and should be spent on something more important...
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<<I don't have a clue about the specifics, either - but I am quite sure that the difference is so small that in 99.99999% of the cases, every second spend thinking about it is wasted and should be spent on something more important..>>
I agree with the above, but I think it is more like 110% of the time
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm I though u guys had an answer.
Thanks a lot anyway.. it is for restricted devices, and I am trying to save some instruction statements that occur a lot..
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how would you write a test for this question?
And why don't you and come and tell us the results?
...tensely
[ May 04, 2004: Message edited by: Stefan Wagner ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tonny Tssagovic:
Thanks a lot anyway.. it is for restricted devices, and I am trying to save some instruction statements that occur a lot..

Than the answer is to use a profiler to find the bottlenecks. It's very unlikely that it's variable access...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!