[roll] Roll fuchsia [superproject] Roll llvm-project/libc [libc] Bound the worst-case stack usage in qsort(). (#110849) Previously, the Quicksort implementation was written in the obvious way: after each partitioning step, it explicitly recursed twice to sort the two sublists. Now it compares the two sublists' sizes, and recurses only to sort the smaller one. To handle the larger list it loops back round to the top of the function, so as to handle it within the existing stack frame. This means that every recursive call is handling a list at most half that of its caller. So the maximum recursive call depth is O(lg N). Otherwise, in Quicksort's bad cases where each partition step peels off a small constant number of array elements, the stack usage could grow linearly with the array being sorted, i.e. it might be Θ(N). I tested this code by manually constructing a List Of Doom that causes this particular quicksort implementation to hit its worst case, and confirming that it recursed very deeply in the old code and doesn't in the new code. But I haven't added that list to the test suite, because the List Of Doom has to be constructed in a way based on every detail of the quicksort algorithm (pivot choice and partitioning strategy), so it would silently stop being a useful regression test as soon as any detail changed. GitOrigin-RevId: 476ad95a78dc437944348645e6c7a1ec034c126b Original-Revision: 410803b30e75b289afdc7f9f3b24cb451b7891ed Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1134072 Original-Revision: 2b65d09a95fa4b7d9d0fd4f8cd35a0394b78173b Change-Id: I83057b48ae9bfa7b1f96cbc03adb865301a3f9cb
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.