]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sort: Cache value of MB_CUR_MAX
authorCyril Zhang <cyril@freebsdfoundation.org>
Thu, 13 May 2021 12:55:06 +0000 (08:55 -0400)
committerMark Johnston <markj@FreeBSD.org>
Thu, 20 May 2021 13:15:43 +0000 (09:15 -0400)
commitdf40dcbf7c794f5448c13e23670466658a620933
treebccbe60fc5e03a6f48de937b95e4b627a19fa5c8
parentf80d1c0035ce2ee5325271ea28916377f813d737
sort: Cache value of MB_CUR_MAX

Every usage of MB_CUR_MAX results in a call to __mb_cur_max.  This is
inefficient and redundant.  Caching the value of MB_CUR_MAX in a global
variable removes these calls and speeds up the runtime of sort.  For
numeric sorting, runtime is almost halved in some tests.

PR: 255551
PR: 255840
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30170

(cherry picked from commit 71ec05a21257e159f40d54e26ad0011bb19b5134)
usr.bin/sort/bwstring.c
usr.bin/sort/bwstring.h
usr.bin/sort/radixsort.c
usr.bin/sort/sort.c
usr.bin/sort/sort.h