From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web09.815.1610563379895688541 for ; Wed, 13 Jan 2021 10:43:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PWHJWkkA; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610563379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h3ic48zpcXgrMUt/hAk1AMo0C5mzQd3RRc4DUqm4NZU=; b=PWHJWkkA+H2JoH4cELYH89u8SZZtIfpmFMcwyVZN1C8n9EH4rgix/YD6NxjcUxTyGjDXsb 5jIFhXcdgaFT2McVp27M0EaVJOcjz2wuNlikPy9Q/1GBeQ2E93WD2v5YmpYyocE2wTzcdm qIWTlrynIgq1fl2l1Q7V8KSA4IR40Qw= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-mudwEjCgN12DzxFqDOPIJw-1; Wed, 13 Jan 2021 13:42:55 -0500 X-MC-Unique: mudwEjCgN12DzxFqDOPIJw-1 Received: by mail-wr1-f72.google.com with SMTP id q18so1354627wrc.20 for ; Wed, 13 Jan 2021 10:42:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=h3ic48zpcXgrMUt/hAk1AMo0C5mzQd3RRc4DUqm4NZU=; b=b7Rxy8UQ/yrmMB6Ow+Gj0Mf5jBWpMHxrJwryAOr7CcM1f2pJWxyVvnFg1mE58R2pTo f8keCKnLAbKalJhUUBPVfWMHNes63CU7G4pXxeDbC4tQJfoVTztbFO9NCbP5m8UnfDlj XPOvEegK24TK70O8uEyN9gzwPstpT3KO/X0E1Wte3rigq1m7gmBt6bhMpgpFrdynHKyd Dh6Fj5jOVj6uFer+tWrLT6AwEIrlMQA77CUffSn8PJPiQNjNYCVYzjpsq9cffyyGAQzk iORlm1gnT/KNnd7Uuw/oWWvxGjGdGrI1i3UOCceVnbs950HN7uW7VhBPjk8vDiFhvUzW FqeA== X-Gm-Message-State: AOAM531AXQRL0eIXg4L0lLTydYyTDotw0XBw1vqKvAhJVz0NnZWac4eA 4r5wE+zkFXMPMuCwODjMjfv5FwHI54/9D4sPHFq+b13SWnIW198fHVlmmH41YABRmNbdDXnyxiq E0TfNrNB1S3DNkw== X-Received: by 2002:a1c:2586:: with SMTP id l128mr580214wml.78.1610563374282; Wed, 13 Jan 2021 10:42:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE8zSvK7k0Yf5H7c8XSzCzx09apO3uv9vEbakvbCuEsiBPiu2Xns6xLa9nnL2R1AJyPzm+Ug== X-Received: by 2002:a1c:2586:: with SMTP id l128mr580203wml.78.1610563374068; Wed, 13 Jan 2021 10:42:54 -0800 (PST) Return-Path: Received: from [192.168.1.36] (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id l1sm5135950wrq.64.2021.01.13.10.42.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Jan 2021 10:42:53 -0800 (PST) Subject: Re: [PATCH v2 01/10] ShellPkg/Comp: add file buffering To: Laszlo Ersek , devel@edk2.groups.io Cc: Ray Ni , Zhichao Gao References: <20210113085453.10168-1-lersek@redhat.com> <20210113085453.10168-2-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Wed, 13 Jan 2021 19:42:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210113085453.10168-2-lersek@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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 > Cc: Philippe Mathieu-Daudé > Cc: Ray Ni > Cc: Zhichao Gao > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3123 > Signed-off-by: Laszlo Ersek > Reviewed-by: Zhichao Gao > --- > > 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(-)