[edk2-devel] [PATCH v2 01/10] ShellPkg/Comp: add file buffering

Philippe Mathieu-Daudé philmd at redhat.com
Wed Jan 13 18:42:52 UTC 2021


On 1/13/21 9:54 AM, Laszlo Ersek wrote:
> 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.

Wow o_O

Reviewed-by: Philippe Mathieu-Daude <philmd at redhat.com>

> Cc: Philippe Mathieu-Daudé <philmd at redhat.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Zhichao Gao <zhichao.gao at intel.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3123
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> Reviewed-by: Zhichao Gao <zhichao.gao at intel.com>
> ---
> 
> Notes:
>     v2:
>     - no changes
>     - pick up Zhichao's R-b
> 
>  ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf |   1 +
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c                         | 127 +++++++++++++++++++-
>  2 files changed, 125 insertions(+), 3 deletions(-)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70256): https://edk2.groups.io/g/devel/message/70256
Mute This Topic: https://groups.io/mt/79646579/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list