Remove custom SkSort algorithms.
SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
The difference is small on randomized inputs, but quite significant for
semi-ordered inputs (forward/backward/repeated). There doesn't seem to
to be any compelling advantage to SkTQSort.
Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u
(These performance numbers are from an optimized build my local machine;
it's possible that we might see different results on the test bots.)
Change-Id: Iaf19563041547eae7de2953be249129108f093b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 603f2b7..eed458d 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -821,10 +821,10 @@
sortedFilenames.push_back(name);
}
if (sortedFilenames.count()) {
- SkTQSort(sortedFilenames.begin(), sortedFilenames.end() - 1,
- [](const SkString& a, const SkString& b) {
- return strcmp(a.c_str(), b.c_str()) < 0;
- });
+ std::sort(sortedFilenames.begin(), sortedFilenames.end(),
+ [](const SkString& a, const SkString& b) {
+ return strcmp(a.c_str(), b.c_str()) < 0;
+ });
}
for (const SkString& filename : sortedFilenames) {
addSlide(filename, SkOSPath::Join(flag.c_str(), filename.c_str()),