audk/ShellPkg/Library
Laszlo Ersek f72fd9616e ShellPkg/Comp: add file buffering
The COMP shell command compares two files byte for byte. In order to
retrieve the bytes to compare, it currently invokes
gEfiShellProtocol->ReadFile() on both files, using a single-byte buffer
every time. This is very inefficient; the underlying
EFI_FILE_PROTOCOL.Read() function may be costly.

Read both file operands in chunks of "PcdShellFileOperationSize" bytes.
Draw bytes for comparison from the internal read-ahead buffers.

Some ad-hoc measurements on my laptop, using OVMF, and the 4KB default of
"PcdShellFileOperationSize":

- When comparing two identical 1MB files that are served by EnhancedFatDxe
  on top of VirtioScsiDxe, this patch brings no noticeable improvement;
  the comparison completes in <1s both before and after.

- When comparing two identical 1MB files served by VirtioFsDxe, the
  comparison time improves from 2 minutes 25 seconds to <1s.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3123
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Message-Id: <20210113085453.10168-2-lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2021-01-19 18:23:28 +00:00
..
UefiHandleParsingLib ShellPkg/UefiHandleParsingLib: Fix error allocate pool 2019-12-05 06:12:36 +00:00
UefiShellAcpiViewCommandLib ShellPkg/Acpiview: AEST Parser 2021-01-08 03:50:34 +00:00
UefiShellBcfgCommandLib ShellPkg: Fix spelling mistake for occurred 2020-08-19 00:54:23 +00:00
UefiShellCEntryLib ShellPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:25 -07:00
UefiShellCommandLib ShellPkg/CommandLib: Use first found UC for unsupported PlatformLang 2019-11-08 08:29:58 +08:00
UefiShellDebug1CommandsLib ShellPkg/Comp: add file buffering 2021-01-19 18:23:28 +00:00
UefiShellDriver1CommandsLib ShellPkg: Fix spelling mistake for occurred 2020-08-19 00:54:23 +00:00
UefiShellInstall1CommandsLib ShellPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:25 -07:00
UefiShellLevel1CommandsLib ShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE 2019-10-09 09:40:10 +02:00
UefiShellLevel2CommandsLib ShellPkg: Fix spelling mistake for occurred 2020-08-19 00:54:23 +00:00
UefiShellLevel3CommandsLib ShellPkg: stop taking EFI_HANDLE in place of SHELL_FILE_HANDLE 2019-10-09 09:40:10 +02:00
UefiShellLib ShellPkg: Fix spelling mistake for occurred 2020-08-19 00:54:23 +00:00
UefiShellNetwork1CommandsLib ShellPkg: Fix 'ping' command Ip4 receive flow. 2020-04-01 10:53:03 +00:00
UefiShellNetwork2CommandsLib ShellPkg: stop using EFI_HANDLE in place of EFI_HII_HANDLE 2019-10-09 09:40:10 +02:00