From: Mihai Moldovan <ionic@ionic.de>
To: The development of GNU GRUB <grub-devel@gnu.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] grub-mkconfig linux: Fix quadratic algorithm for sorting menu items
Date: Tue, 3 May 2022 19:15:47 +0200 [thread overview]
Message-ID: <b54eaaa6-5cfd-ec2d-b792-9bbcf9af4578@ionic.de> (raw)
In-Reply-To: <285878595.44472.1651588937097.JavaMail.zimbra@efficios.com>
[-- Attachment #1.1: Type: text/plain, Size: 1374 bytes --]
Just a nit, feel free to ignore it...
* On 5/3/22 4:42 PM, Mathieu Desnoyers wrote:
> How does the following paragraph sound ?
>
> ^^^^^^^^
> Here is the improved algorithm proposed:
>
> - Prepare a list with all the relevant information for ordering by a single
> sort(1) execution. This is done by renaming ".old" suffixes by " 1" and
> by suffixing all other files with " 2", thus making sure the ".old" entries
> will follow the non-old entries in reverse-sorted-order.
> - Call version_reverse_sort on the list (sort -r -V): A single execution of
> sort(1) will reverse-sort the list in O(n*log(n)) with a merge sort.
This is correct for GNU coreutils's sort, but nothing (I'm mostly thinking of
SUS/POSIX here) mandates that the sort utility must either use merge sort or
have O(n*log(n)) time complexity.
Given that you're using version sort, which is a GNU extension, it probably
can't be anything than GNU sort anyway, though, so the point still holds by
implicity.
However, this also means that you're adding a hidden dependency upon GNU
coreutils sort here, which will hit systems traditionally not using the GNU
userland by default, most prominently BSDs (which, I might add, seem not to use
GRUB by default and generally either discourage it or have thrown it out of
their package management systems).
Mihai
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2022-05-03 17:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 14:14 [PATCH] grub-mkconfig linux: Fix quadratic algorithm for sorting menu items Mathieu Desnoyers
2022-05-03 8:47 ` Paul Menzel
2022-05-03 14:42 ` Mathieu Desnoyers
2022-05-03 14:47 ` Paul Menzel
2022-05-03 17:15 ` Mihai Moldovan [this message]
2022-05-04 0:54 ` Oskari Pirhonen
2022-05-04 3:54 ` Mihai Moldovan
2022-05-19 20:21 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b54eaaa6-5cfd-ec2d-b792-9bbcf9af4578@ionic.de \
--to=ionic@ionic.de \
--cc=grub-devel@gnu.org \
--cc=mathieu.desnoyers@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.