[gwt-contrib] Re: Faster version of LongLib (issue572801)

2010-06-03 Thread rice

http://gwt-code-reviews.appspot.com/572801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Faster version of LongLib (issue572801)

2010-06-03 Thread jat

LGTM


http://gwt-code-reviews.appspot.com/572801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Faster version of LongLib (issue572801)

2010-06-02 Thread scottb


http://gwt-code-reviews.appspot.com/572801/diff/9001/10015
File user/super/com/google/gwt/emul/java/lang/Number.java (right):

http://gwt-code-reviews.appspot.com/572801/diff/9001/10015#newcode245
user/super/com/google/gwt/emul/java/lang/Number.java:245: private static
final int[] maxLengthForRadix = {-1, -1, // unused
Can you move these three static-init arrays into a static nested class;
otherwise you're forcing all of java.lang.Number to have a clinit, which
is less than ideal.

See Decode for example.

http://gwt-code-reviews.appspot.com/572801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Faster version of LongLib (issue572801)

2010-06-02 Thread rice

http://gwt-code-reviews.appspot.com/572801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Faster version of LongLib (issue572801)

2010-06-01 Thread rice

http://gwt-code-reviews.appspot.com/572801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Faster version of LongLib (issue572801)

2010-06-01 Thread jat

LGTM, just a few comments.


http://gwt-code-reviews.appspot.com/572801/diff/9001/10005
File dev/core/super/com/google/gwt/lang/LongLibBase.java (right):

http://gwt-code-reviews.appspot.com/572801/diff/9001/10005#newcode55
dev/core/super/com/google/gwt/lang/LongLibBase.java:55: protected static
boolean RUN_IN_JVM = false;
This should be documented -- if it does what I think it does, which is
to allow you to debug this in the JVM during development, then this
should be final.

http://gwt-code-reviews.appspot.com/572801/diff/9001/10005#newcode414
dev/core/super/com/google/gwt/lang/LongLibBase.java:414: private static
int nlz(int x) {
Replace calls to this method with a call to
Integer.numberOfLeadingZeros(x).

If this algorithm is faster, the method in Integer should be updated.

http://gwt-code-reviews.appspot.com/572801/diff/9001/10005#newcode459
dev/core/super/com/google/gwt/lang/LongLibBase.java:459: private static
int powerOfTwo(int x) {
Is this guaranteed to be called with a power of 2?

x  -x will give you the lowest bit set -- not sure if there are any
edge cases or if this is faster, but you might consider:

// if not a power of two, return (check for 0 if not non-zero)
if (x != x  -x) {
  return -1;
}
return Integer.numberOfTrailingZeros(x);

Again, if numberOfTrailingZeros isn't fast enough, update it with a
better algorithm.

http://gwt-code-reviews.appspot.com/572801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors