> Using nextSetBit() repeatedly is a non-starter since compared to the > integer-by-integer approach, every operation will be bit-by-bit. This will be > x-times slower, where x is the average number of bits set in an integer.
I guess I wasn't clear in this regard, I was talking about just refactoring out a method that's just the core of nextSetBit, perhaps with the name nextValue. This would find the next integer index into the array, it would not operate on the bit level. This is would be very fast for dense arrays since the first thing it would check would be the next index, and it'd find it. > So, I recommend refactoring all code such that getWordPositions, getWord, and > setWord are the *only* 3 JSNI methods. I *think* this is possible. Thoughts? The > Gwt compiler will also be able to optimize better with only 3 Jsni methods. There are two other methods I think are essential One to set the length(JsArrayInteger array, int length) { array.length = length; } and one to delete(JsArrayInteger array, int index) { delete array[index]; } I also don't think methods like trimToSize are nearly as efficient in Java, it's not hard to read, and I don't think there's much the compiler can optimize there. This is a large class. How about I start by getting rid of as many JSNI methods as I can. http://gwt-code-reviews.appspot.com/33815 --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---