diff options
author | Laszlo Ersek <lersek@redhat.com> | 2021-01-13 09:54:44 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-01-19 18:23:28 +0000 |
commit | f72fd9616eedac9a521adcbbe5086dd666c67232 (patch) | |
tree | 9835b5214a6f968e0f92f201a4868af9def20ab0 /BaseTools/Source/Python/Table/TableFunction.py | |
parent | e68c2a22caaeca5b249d8849c2ee4476d5b19788 (diff) | |
download | edk2-f72fd9616eedac9a521adcbbe5086dd666c67232.tar.gz edk2-f72fd9616eedac9a521adcbbe5086dd666c67232.tar.bz2 edk2-f72fd9616eedac9a521adcbbe5086dd666c67232.zip |
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>
Diffstat (limited to 'BaseTools/Source/Python/Table/TableFunction.py')
0 files changed, 0 insertions, 0 deletions