Home arrow static arrow Java Programming [Archive] - Casting costs in JDK 1.4 + Nil?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Casting costs in JDK 1.4 + Nil?
This topic has 21 replies on 2 pages.    « Previous | 1 | 2 |

Posts:11
Registered: 7/17/03
Re: Casting costs in JDK 1.4 + Nil?  
Aug 4, 2004 2:10 PM (reply 15 of 21)



 
My question came about when I was reviewing our caching at work, and someone noted that we use collection objects to store cached objects, and thus might be paying a high cost casting objects when we pull things out of the cache, maybe we could use arrays. I started to do some research and could only find articles saying avoid casting if possible because of the costs, but these articles were using JDK 1.2.x for their testing. I started to re-run the tests the articles had used with JDK 1.4.1_02 and the costs seemed negligible at best..... now, which data structure to use for doing x and y fast is a different subject entirely which I don't want to approach here....

 

Posts:6,750
Registered: 1/25/04
Re: Casting costs in JDK 1.4 + Nil?  
Aug 4, 2004 2:20 PM (reply 16 of 21)



 
Aw, come on, that's a fun one!
 

Posts:11
Registered: 7/17/03
Re: Casting costs in JDK 1.4 + Nil?  
Aug 4, 2004 2:23 PM (reply 17 of 21)



 
I'm saving that thread for tommorow! :)
 

Posts:6,750
Registered: 1/25/04
Re: Casting costs in JDK 1.4 + Nil?  
Aug 4, 2004 2:25 PM (reply 18 of 21)



 
LOL, I'll stay tuned.
 

Posts:6,750
Registered: 1/25/04
Re: Casting costs in JDK 1.4 + Nil?  
Aug 4, 2004 2:26 PM (reply 19 of 21)



 
Oh BTW the collections forum would be the best place to post that.
 

Posts:27,518
Registered: 11/3/97
Re: Casting costs in JDK 1.4 + Nil?  
Aug 5, 2004 8:28 AM (reply 20 of 21)



 

But just a min. How do you know that the OP is using
JIT compiler.

From the OP....


and ran it with JDK 1.4.1_02


And that uses Hotspot.

Perhaps you were referring to the possibility that it wasn't actually compiled by the VM?
 

Posts:27,518
Registered: 11/3/97
Re: Casting costs in JDK 1.4 + Nil?  
Aug 5, 2004 8:29 AM (reply 21 of 21)



 
My question came about when I was reviewing our
caching at work, and someone noted that we use
collection objects to store cached objects, and thus
might be paying a high cost casting objects when we
pull things out of the cache, maybe we could use
arrays. I started to do some research and could only
find articles saying avoid casting if possible because
of the costs, but these articles were using JDK 1.2.x
for their testing. I started to re-run the tests the
articles had used with JDK 1.4.1_02 and the costs
seemed negligible at best..... now, which data
structure to use for doing x and y fast is a different
subject entirely which I don't want to approach
here....

You want to enhance the performance of the application?

And are you using a profiler? If so then simply test both cases. If not, then how did you determine the bottlenecks in the app in the first place?

 
This topic has 21 replies on 2 pages.    « Previous | 1 | 2 |