I doubt it'll be faster, not with array bounds checking and the
typical Java overhead. Feel free to benchmark using Caliper, for
example:

http://code.google.com/p/caliper/

Dawid

On Sun, Jan 13, 2013 at 4:37 PM, Shai Erera <[email protected]> wrote:
> Hi
>
> Both these classes set/get do this:
>
> int bit = index & 0x3f;           // mod 64
> long bitmask = 1L << bit;
>
> Since bit has only 64 values, bitmask can only be 1, 10, 100... etc. I was
> thinking that instead of doing the <<, we can have a static BIT_MASK array,
> indexed by bit, and then we could use it to compute bitmask.
>
> But that replaces a bitwise shift by an array access, so I'm not sure how
> much more efficient it will be? If the array is *hot* and in the L1 cache,
> then it's supposed to be faster?
>
> Thoughts?
>
> Shai

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to