public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* RFC: Add BaseLib/QuickSort in MdePkg
@ 2021-09-14  6:15 Ni, Ray
  2021-09-16  1:26 ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 21+ messages in thread
From: Ni, Ray @ 2021-09-14  6:15 UTC (permalink / raw)
  To: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Wang, Jian J,
	Gao, Zhichao
  Cc: devel@edk2.groups.io, Chan, Amy

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

Hi package maintainers of MdePkg, MdeModulePkg and ShellPkg, community,

A commit (UefiCpuPkg/CpuCacheInfoLib: Sort CpuCacheInfo array<https://github.com/tianocore/edk2/commit/4de77ae9890d241271f543e9195ab3516f3abec6>) to UefiCpuPkg let
UefiCpuPkg depend on MdeModulePkg because the SortLib class and instances are all in MdeModulePkg.

UefiCpuPkg depending on MdeModulePkg breaks the rule that "UefiCpuPkg should ONLY depend on MdePkg".

To address this issue, there are two approaches:

  1.  Duplicate the sort logic in UefiCpuPkg to not depend on MdeModulePkg/SortLib
  2.  Add QuickSort() API to BaseLib in MdePkg.

Approach #2 (MdePkg/BaseLib/QuickSort) makes more sense because quick sort is a standard algorithm.
We encourage consumers to update their code to use the quick sort in MdePkg and gradually deprecate today's MdeModulePkg/SortLib.

If you don't have concerns, I plan to:

  1.  "Add QuickSort() to BaseLib" and update all existing consumers to use this API instead.
VOID
EFIAPI
QuickSort (
  IN OUT VOID                   *BufferToSort,
  IN CONST UINTN                Count,
  IN CONST UINTN                ElementSize,
  IN       SORT_COMPARE         CompareFunction
  );


  1.  "Add new ShellPkg/SortCompareLib"

Background: ShellPkg requires to sort devicepath/string so 3 APIs in UefiSortLib (DevicePathCompare, StringNoCaseCompare, StringCompare) are provided for Shell usage. we can move the 3 APIs to the SortCompareLib and update Shell code to use BaseLib/QuickSort directly, with the sort compare function from SortCompareLib.

Any concerns?

Thanks,
Ray

[-- Attachment #2: Type: text/html, Size: 10341 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-09-29  2:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-14  6:15 RFC: Add BaseLib/QuickSort in MdePkg Ni, Ray
2021-09-16  1:26 ` 回复: [edk2-devel] " gaoliming
2021-09-16  2:13   ` Andrew Fish
2021-09-16  2:23     ` 回复: " gaoliming
2021-09-16  2:45       ` Chan, Amy
2021-09-16  2:47         ` Ni, Ray
2021-09-22  6:03           ` Ni, Ray
     [not found]           ` <16A70FAC1585C7C1.27516@groups.io>
2021-09-24  3:53             ` Ni, Ray
2021-09-26  2:00               ` 回复: " gaoliming
2021-09-26  2:24                 ` Ni, Ray
2021-09-26 11:20                   ` Marvin Häuser
2021-09-27  0:45                     ` Jeff Fan
2021-09-27  8:14                       ` Marvin Häuser
2021-09-27  8:50                         ` Jeff Fan
2021-09-27  9:09                           ` Marvin Häuser
2021-09-28  1:49                             ` Ni, Ray
2021-09-28 22:25                               ` Brian J. Johnson
2021-09-29  0:51                                 ` 回复: " gaoliming
2021-09-29  2:42                                   ` Ni, Ray
     [not found]                         ` <16A8A1ADDB4E97C4.26412@groups.io>
2021-09-27  9:06                           ` Jeff Fan
2021-09-16  2:47       ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox