code: EDiff optimizedDiff(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx,
          final DepthCounter paramDepth, final EFireDiff paramFireDiff) throws TTIOException {
          assert paramNewRtx != null;
          assert paramOldRtx != null;
          assert paramDepth != null;
  
          EDiff diff = EDiff.SAMEHASH;
  
          // Check for modifications.
          switch (paramNewRtx.getNode().getKind()) {
          case ROOT:
          case TEXT:
          case ELEMENT:
              if (paramNewRtx.getNode().getDataKey() != paramOldRtx.getNode().getDataKey()
                  || paramNewRtx.getNode().getHash() != paramOldRtx.getNode().getHash()) {
                  // Check if nodes are the same (even if subtrees may vary).
                  if (checkNodes(paramNewRtx, paramOldRtx)) {
                      diff = EDiff.SAME;
                  } else {
                      diff = diffAlgorithm(paramNewRtx, paramOldRtx, paramDepth);
                  }
              }
              break;
          default:
              // Do nothing.
          }
  
          if (paramFireDiff == EFireDiff.TRUE) {
              if (diff == EDiff.SAMEHASH) {
                  fireDiff(EDiff.SAME, ((ITreeStructData)paramNewRtx.getNode()), ((ITreeStructData)paramOldRtx
                      .getNode()), new DiffDepth(paramDepth.getNewDepth(), paramDepth.getOldDepth()));
              } else {
                  fireDiff(diff, ((ITreeStructData)paramNewRtx.getNode()), ((ITreeStructData)paramOldRtx.getNode()),
                      new DiffDepth(paramDepth.getNewDepth(), paramDepth.getOldDepth()));
              }
          }
          return diff;
      }
docs: Optimized diff, which skips unnecessary comparsions.
  
  @param paramNewRtx
  {@link IReadTransaction} on new revision
  @param paramOldRtx
  {@link IReadTransaction} on old revision
  @param paramDepth
  {@link DepthCounter} container for current depths of both
  transaction cursors
  @param paramFireDiff
  determines if a diff should be fired
  @return kind of difference
  @throws TTIOException