help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Counting words, fast!


From: Jesse Hathaway
Subject: Re: Counting words, fast!
Date: Tue, 16 Mar 2021 17:31:41 -0500

On Tue, Mar 16, 2021 at 5:19 PM Leonid Isaev (ifax)
<leonid.isaev@ifax.com> wrote:
> Nice, but I don't understand why did you choose to implement insertion sort
> in bash? Replacing it with GNU sort(1) significantly cuts down execution time:

I was following what I took as the spirit of the constraints:

https://benhoyt.com/writings/count-words/#problem-statement-and-constraints

which don't allow anything but a language's standard library. Surprisingly,
the bulk of the processing time is in reading of the file and constructing
the frequency associative array, not in the sorting.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]