Add micro optimizations based on profiling for sorting and escaping MultiTerms

Change-Id: I919275ebc31bb25ee07917e78c00fc52b1c77b9b
2 files changed