"Joseph H. Buehler" wrote:

> That's about 14 microseconds per loop, which is very slow, given what
> the code is doing on each pass through the loop: setting a bit in a
> bit array.
> 
> Preallocating the BitSet doesn't change things.  I installed tya using
> egcs, and tried various optimization flags, and some minor variations
> in tyaconfig.h, but the timing does not vary a whole lot.
> 
> Do these results seem reasonable?

You have not given results for jdk without tya. I've done few tests, and
tya gives me 2.5x speedup on this test. For comparison symcjit is about
16x faster. After some divisions I came up with following numbers (all
are quite rounded)

5000 cycles per iteration for plain jdk
1900 cycles per iteration for tya
300 cycles per iteration for symcjit

I think that that are quite reasonable number if you think about all
things that have to be done. For set method there are about 4 method
calls that need to be done + one synchronization. Additional problem is
that BitSet uses longs internally which causes a major slowdown on
intel.

Try to rewrite your benchmark using explicit array of ints, preallocated
to correct size, and then just fill it bit after bit. This way you will
get bare speed of java, without BitSet overhead. BitSet was not designed
to perform as buffer for image manipulation.

Artur

Reply via email to