audk/ShellPkg
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
..
Application ShellPkg/AcpiView: Add application wrapper 2020-06-30 01:39:50 +00:00
DynamicCommand ShellPkg/DynamicCommand: add HttpDynamicCommand 2020-09-30 01:28:51 +00:00
Include ShellPkg/DynamicCommand: add HttpDynamicCommand 2020-09-30 01:28:51 +00:00
Library ShellPkg/Comp: add file buffering 2021-01-19 18:23:28 +00:00
ShellPkg.ci.yaml ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check 2020-08-17 03:28:09 +00:00
ShellPkg.dec ShellPkg/DynamicCommand: add HttpDynamicCommand 2020-09-30 01:28:51 +00:00
ShellPkg.dsc ShellPkg/DynamicCommand: add HttpDynamicCommand 2020-09-30 01:28:51 +00:00