Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.arch Subject: Re: Optimization by programmers Date: Sun, 20 Sep 2026 07:31:08 -0700 Organization: A noiseless patient Spider Lines: 21 Message-ID: <86a4pct2oj.fsf@linuxsc.com> References: <1177fdi$26ea4$1@dont-email.me> <117pq4r$gi10$1@dont-email.me> <117thvb$1ocse$1@dont-email.me> <2026Sep10.192237@mips.complang.tuwien.ac.at> <1736alhffrj7iuhfsesdo31bofc0m8pr12@4ax.com> <2026Sep11.083321@mips.complang.tuwien.ac.at> <6aa5876f.783937@news.eternal-september.org> <2026Sep12.201446@mips.complang.tuwien.ac.at> <6aa6172e.15711625@news.eternal-september.org> <2026Sep13.162747@mips.complang.tuwien.ac.at> <118h4cj$fi2a$1@dont-email.me> <118ltsc$26ss6$1@dont-email.me> <2026Sep19.175649@mips.complang.tuwien.ac.at> <118odha$31okp$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sun, 20 Sep 2026 14:31:09 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3288574"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//b0BLKVdkttZrzs7fq94RRJx1VmMH3Kc="; posting-host="410b0e977588f2020be66e3609456ad1" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:WH2/FYDIsDm68MAAGEzEiDo1n94= sha1:4mCm1NZvknrOxIbR6c895SzRRbk= sha256:YUkpRzlhwTfbQSmQimPGrWyDosD3aTMVNaK+TWKoc94= sha1:FBq/6mT2Ziz7uBxrXV7/LmHSuFw= sha256:IkuvLN6y/egTaT41ixM42pTZ7NaFxNt+YGmB35FPLgY= Xref: csiph.com comp.arch:118108 Thomas Koenig writes: > Bubblesort is the worst of non-joke sorting algorithms, see > the quote from Numerical Recipes... For people who don't like bubble sort, or for inclusion in a set of benchmarks, I suggest the following recently discovered sorting algorithm (written in C-ish pseudocode): void baffle_sort( unsigned n, int *elements ){ for( unsigned i = 0; i < n; i++ ){ for( unsigned j = 0; j < n; j++ ){ if( elements[i] < elements[j] ){ /* exchange elements[i] and elements[j] */ } } } } (Disclaimer: not original.)