Thread View: comp.lang.java
2 messages
2 total messages
Started by jochem
Mon, 08 Oct 2001 18:16
Advanced question need help
Author: jochem
Date: Mon, 08 Oct 2001 18:16
Date: Mon, 08 Oct 2001 18:16
8 lines
1901 bytes
1901 bytes
Hi There, I am trying to find out the relative costs of bitshifting vs casting in java (on primitive types). Can anyone give me any suggestions? if you can give me just the cost of cast that would be brilliant Cheers Jochem
Re: Advanced question need help
Author: Marshall Spight
Date: Tue, 09 Oct 2001 16:14
Date: Tue, 09 Oct 2001 16:14
26 lines
2519 bytes
2519 bytes
"jochem" <jmelis@cs.uct.ac.za> wrote in message news:9psqh3$33k$1@news.adamastor.ac.za... > Hi There, > > I am trying to find out the relative costs of bitshifting vs casting in java > (on primitive types). > Can anyone give me any suggestions? if you can give me just the cost of > cast that would be brilliant I wrote an appalingly extensive article on the cost of casting. It comes down to roughly 4-9 clock cycles, depending on the situation, and zero in some cases. I had it up on my website. If some non-bankrupt ISP ever decides to offer the capability of hosting a website in my neighborhood, it'll be up again. I'd imagine bitshifting was similarly cheap, or maybe even cheaper, but this is pure speculation. My advice? Write whichever way is cleaner and easier to code; the difference in efficiency will not matter under any circumstances that are likely to occur. Marshall
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads