[libcxx-commits] [PATCH] D113413: Add introsort to avoid O(n^2) behavior and a benchmark for adversarial quick sort input.

Andrew Grieve via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 8 08:08:33 PDT 2022


agrieve added a comment.

In D113413#3548857 <https://reviews.llvm.org/D113413#3548857>, @hiraditya wrote:

> In D113413#3528143 <https://reviews.llvm.org/D113413#3528143>, @agrieve wrote:
>
>> re: binary size - std::sort-related symbols make up more than 1% of Chrome's binary size (for arm32 Android at least). Any work to reduce the size overhead of std::sort() would be very welcome. From what I can tell, the main contributing factor is the templated nature of the function. It gets stamped out a *lot* of times, and in a way that identical-code-folding is often not applicable.
>
> Will it help to explicitly specialize some of the commonly used templates in Chrome?

We enable identical code folding, so I don't see how that would help.

If we could identify at compile time when sort is being called with aggregates / PODs and route all such calls through qsort(), I think that might help.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113413/new/

https://reviews.llvm.org/D113413



More information about the libcxx-commits mailing list