opnsense-src/lib/libc/tests/stdlib
Dag-Erling Smørgrav 5205b32de3 libc: Drop incorrect qsort optimization
As pointed out in the PR and the article linked below, the switch to
insertion sort in the BSD qsort code is based on a misunderstanding of
Knuth's TAOCP and is actually a pessimization.  As demonstrated by the
added test, it is trivially easy to construct pathological input which
results in quadratic runtime.  Without that misguided optimization, the
same input runs in nearly linearithmic time.

https://www.raygard.net/2022/02/26/Re-engineering-a-qsort-part-3

PR:		287089
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D51907
2025-08-15 09:23:03 +02:00
..
dynthr_mod Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
libatexit libc: tests: add some tests for __cxa_atexit handling 2025-04-04 19:47:54 -05:00
clearenv_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
cxa_atexit_test.c libc: tests: add some tests for __cxa_atexit handling 2025-04-04 19:47:54 -05:00
cxa_thread_atexit_nothr_test.cc libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
cxa_thread_atexit_test.cc libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
dynthr_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
getenv_r_test.c getenv_r tests: Fix getenv_r_erange 2025-05-06 13:49:17 +00:00
heapsort_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
libc_exit_test.c libc tests: Add some test cases for recursive exiting 2024-08-07 16:06:11 +00:00
Makefile libc: Drop incorrect qsort optimization 2025-08-15 09:23:03 +02:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
mergesort_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
qsort_b_test.c
qsort_bench.c libc: Drop incorrect qsort optimization 2025-08-15 09:23:03 +02:00
qsort_r_compat_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
qsort_r_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
qsort_s_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
qsort_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
set_constraint_handler_s_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
strfmon_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
test-sort.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
tsearch_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00