From patchwork Fri Feb 28 15:07:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Hocevar X-Patchwork-Id: 11412509 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E8281580 for ; Fri, 28 Feb 2020 15:16:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 385A6246AF for ; Fri, 28 Feb 2020 15:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbgB1PQC (ORCPT ); Fri, 28 Feb 2020 10:16:02 -0500 Received: from srv2.zoy.org ([193.200.42.164]:51979 "EHLO smtp.zoy.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726979AbgB1PQB (ORCPT ); Fri, 28 Feb 2020 10:16:01 -0500 X-Greylist: delayed 529 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 Feb 2020 10:16:01 EST Received: by smtp.zoy.org (Postfix, from userid 1000) id 82EBF360CAB; Fri, 28 Feb 2020 16:07:10 +0100 (CET) Date: Fri, 28 Feb 2020 16:07:10 +0100 From: Sam Hocevar To: git@vger.kernel.org Subject: [PATCH] git-p4: reverse large file detection order Message-ID: <20200228150710.ikgijcxlft5wjl3h@hocevar.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It is more efficient to first check for a file's extension against git-p4.largeFileExtensions before git-p4.largeFileCompressedThreshold because the latter test may trigger a costly compression task. Signed-off-by: Sam Hocevar --- git-p4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git git-p4.py git-p4.py index 40d9e7c594..a54970aa74 100755 --- git-p4.py +++ git-p4.py @@ -1197,7 +1197,7 @@ def processContent(self, git_mode, relPath, contents): """Processes the content of git fast import. This method decides if a file is stored in the large file system and handles all necessary steps.""" - if self.exceedsLargeFileThreshold(relPath, contents) or self.hasLargeFileExtension(relPath): + if self.hasLargeFileExtension(relPath) or self.exceedsLargeFileThreshold(relPath, contents): contentTempFile = self.generateTempFile(contents) (pointer_git_mode, contents, localLargeFile) = self.generatePointer(contentTempFile) if pointer_git_mode: