Tree perf improvements

1. Cache entity in EntityWrapper
2. Improve EntityComparator for TimelineElements, comparing start time
if available.