From patchwork Tue Feb 4 21:12:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 11365251 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 3C118921 for ; Tue, 4 Feb 2020 21:12:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1AD1921744 for ; Tue, 4 Feb 2020 21:12:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=web.de header.i=@web.de header.b="GE0PgXno" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727480AbgBDVMP (ORCPT ); Tue, 4 Feb 2020 16:12:15 -0500 Received: from mout.web.de ([212.227.15.4]:35519 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727389AbgBDVMO (ORCPT ); Tue, 4 Feb 2020 16:12:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1580850729; bh=InT7BiZ8VIIcfIwRwSsCKNYHxWuS9mCCV1Ipzx8r4Fc=; h=X-UI-Sender-Class:To:Cc:From:Subject:Date; b=GE0PgXnoZmij9ZKr7NbZIEHAHT1VjIcM8eaTY43d2HSCTHxANj2e26cAO7wvlV3Ly e/l6w/SldRbTDioGbr05v5yr+EAhDXXYZbhUJMqVoLSzuiYeolJo+3lo5u8Wl0xkm1 OVhyjEm1zFgCk3ETR2tqFHui1L2ao2qa8st9v+KI= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.178.26] ([91.47.145.153]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LshXV-1jeQnA0mfx-012Dmy; Tue, 04 Feb 2020 22:12:09 +0100 X-Mozilla-News-Host: news://nntp.public-inbox.org:119 To: Git Mailing List Cc: =?utf-8?q?SZEDER_G=C3=A1bor?= , =?utf-8?q?Martin_?= =?utf-8?q?=C3=85gren?= , Junio C Hamano From: =?utf-8?q?Ren=C3=A9_Scharfe?= Subject: [PATCH 00/10] name-rev: improve memory usage Message-ID: <084909f8-fefa-1fe0-b2ce-74eff47c4972@web.de> Date: Tue, 4 Feb 2020 22:12:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Language: en-US X-Provags-ID: V03:K1:i5xaUzU6Uwb/H4wpd1iok1lH9+qwxFzV58i7ZpzFotihV+1Z8Fc WHPTEZvBTtIEBZL7mGl2J5lSN+kQuAVWQ31YqJJODeRtR6IrJ8SJnm9P6v5I4cJ+M10mmTl P2yZRxbFYuU9EWHqacjriH6jVsBOyxVjko/CcVsN2UdCYX2uPyXPBcwzHXgvKD3yZ9pXDqi Eno0xUkCOigKY1QrT5/Nw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:PHybbFFVhpY=:wYaTpI595vNB0mH5VOi/6u Ouw06KP56p5RXWZrJPmPUJckYgi3VlhY3xE7cPR9eYUCSSclaEVynR6pV1iyR66AxtIoGda+I Us9vfCvT1J4VfbnCa/V/7LfRCxScqZIWXB4wQw3QU6TTaeIGclkVwUtoH3E5pqxlDbRrt7PmW /Ldq9lh811JvTcMKlzlcguZE7nVUeFmvpMx/L3zjk0lMniBOyY7pQW2sdUA7v52knj60iKU7H EafNXTTFtzd+tlHojbFF7ZZdTVd2o9Y9badJn1ChOGiNtUFEV64ANf4E0TKl2UfgoKvmaUAbm +hqKkUKB5xJ6HZRnaR60Hgn9b8JovdWgE6Won7C+q56GCA9fcTIqhTLr9t6S/BWovTVp03hJG h8rlLSO06JmsAywboK5Z5IGzeT+a6fhU9lT2NJ69q5GA4SB8PuitPQgu7pJ38ROKT+bYML+ez ym466kUFxeeqYgV8MW/bJ5KPzCusA22zAZwIAbJBez/3lUOVFu8IUB/8y+KEEyCK7Ez1Yqocq vqe4OTvMGzL31XtG/xpDUSL0Yqp7qy8hguEEQ0bWTJ/om8I49M2K7IjKZCEOWXDZRm1fZLpH/ pAGDd8QLSYiPRc8UFVKxG3IVSDqBCy9z8D55cstfkUyRqy3Wkc3QCoYJfqxTvaUGN//6qzwIE Kh0Qa0KV1ZXVetWfJrTcN0ZHg4qkFV5FnogmlI8KQZntPwD2TPgCc4HO4B6bCvMVeZJHgMpYX YESPYwKlbRwwz6R/+fc56oSpB+LiE52+3V3wlGFifh3lbIKEbnHXSyOOr1i7vRs8y1zMThKZ5 7gdbPhXdeDXz2RXOpSnCrBiudtuhGRgIUTG/apWHAEvr3TIq3LNFIUfO/r1klOrcA2igEYDHm aiB63PIr51fWowUmM5iPtsius9DjSO49heWmF9ZrRQJeCTeR6Px9xDv9GxBr3Va/Ky3uTBVkf 05pBCBCCFd7wqjWh9MeTskGQUGYy93Ie+2krpYNEAmXwz09YQk5js11WvcVsVmmywoZd1joVs WN7oMrihqZgla/1BPea+N5n5ojzx3+uEoIxAJzSrE2syHGGTwMPDmN6PL7DD3rkmvxOLbe4NP ZfLJuT36V4Ct38fysIM48Xhk+AoUZoNgKpXt7AcmvEseyPt9C4jjYArivUTg5teTX4GC5q0jV o5bEOsHHicWdyca1UdQTXdRw38qfgdxJ0G8xTMPBVczcrgg28ws46A+33izAmcBANaPXkx36f B35vZJndB5NiADNNP Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This series seeks to get reduce the size of memory allocations, the number of reallocations and the amount of leaks in git name-rev, to improve its performance. It starts with a few cleanups: Martin Ågren (1): name-rev: rewrite create_or_update_name() René Scharfe (9): name-rev: remove unused typedef name-rev: respect const qualifier name-rev: don't _peek() in create_or_update_name() ... then plugs a minor leak: name-rev: don't leak path copy in name_ref() ... and gets rid of a level of indirection in commit slab usage: name-rev: put struct rev_name into commit slab The next two patches eliminate reallocations while building name strings for parent commits, which can make a surprisingly big difference in some cases: name-rev: factor out get_parent_name() name-rev: pre-size buffer in get_parent_name() The next one avoids building names that are be discarded right away by checking first if they are better than a possibly present other name assigned earlier, which only provides a small speedup, but is the right thing to do: name-rev: generate name strings only if they are better And finally a tricky one whose commit message is a lot longer than its diff, which adds a bit of overhead and which probably needs the most reviewer attention to make sure it won't cause double frees: name-rev: release unused name strings builtin/name-rev.c | 133 ++++++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 57 deletions(-) --- 2.25.0