Some comments about performance.

http://codereview.appspot.com/27117/diff/1/2
File java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
(right):

http://codereview.appspot.com/27117/diff/1/2#newcode142
Line 142: } else if (authority != null) {
This might be clearer if there was progressive nesting, so:

} else {
  scheme = getScheme();
  if (authority == null) {
    authority = getAuthority();
    if (... )
  }
etc...

Then again, it might not.

http://codereview.appspot.com/27117/diff/1/2#newcode184
Line 184: Stack<String> pathStack = new Stack<String>();
java.util.Stack is largely deprecated.  (It extends *Vector*, yikes.)

http://codereview.appspot.com/27117/diff/1/2#newcode186
Line 186: Collections.addAll(pathStack, curPath.split("/"));
I think it's faster to use StringTokenizer:  String.split() parses a
regex.  Plus, this builds an array just to throw it away.

http://codereview.appspot.com/27117/diff/1/2#newcode193
Line 193: LinkedList<String> mergePath = new LinkedList<String>();
ArrayList would be faster

http://codereview.appspot.com/27117/diff/1/2#newcode194
Line 194: Collections.addAll(mergePath, otherPath.split("/"));
split() -> StringTokenizer, ditto

http://codereview.appspot.com/27117

Reply via email to