This is the codepath used by Report() / ReportAt(), which is the fast path for reporting stats in v4. Skipping the sort saves us some work:
benchmark old ns/op new ns/op delta
BenchmarkTagsBufferSortSorted-12 107 49.3 -53.93%
BenchmarkTagsBufferSortUnsorted-12 270 271 +0.37%
While users are less likely to have already-sorted stat tags in this case (because the tagsBuffer tag slice is built on every call and doesn't retain its sort between calls the way that you would retain sorted engine tags if you were calling stats.Incr() without tags often), it can show up in benchmarks and guide users toward this little cheat by passing in their tags in sorted order.
This is the codepath used by Report() / ReportAt(), which is the fast path for reporting stats in v4. Skipping the sort saves us some work:
While users are less likely to have already-sorted stat tags in this case (because the tagsBuffer tag slice is built on every call and doesn't retain its sort between calls the way that you would retain sorted engine tags if you were calling stats.Incr() without tags often), it can show up in benchmarks and guide users toward this little cheat by passing in their tags in sorted order.