From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id B6A3E1F8C6 for ; Mon, 12 Jul 2021 17:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233555AbhGLSBk (ORCPT ); Mon, 12 Jul 2021 14:01:40 -0400 Received: from cloud.peff.net ([104.130.231.41]:46744 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbhGLSBj (ORCPT ); Mon, 12 Jul 2021 14:01:39 -0400 Received: (qmail 19541 invoked by uid 109); 12 Jul 2021 17:58:51 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 12 Jul 2021 17:58:51 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 8373 invoked by uid 111); 12 Jul 2021 17:58:51 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 12 Jul 2021 13:58:51 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 12 Jul 2021 13:58:50 -0400 From: Jeff King To: Junio C Hamano Cc: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , git@vger.kernel.org Subject: Re: [PATCH 2/3] strbuf.h API users: don't hardcode 8192, use STRBUF_HINT_SIZE Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Jul 07, 2021 at 03:37:56PM -0700, Junio C Hamano wrote: > Ævar Arnfjörð Bjarmason writes: > > > Change a couple of users of strbuf_init() that pass a hint of 8192 to > > pass STRBUF_HINT_SIZE instead. > > > > Both of these hardcoded occurrences pre-date the use of the strbuf > > API. See 5242bcbb638 (Use strbuf API in cache-tree.c, 2007-09-06) and > > af6eb82262e (Use strbuf API in apply, blame, commit-tree and diff, > > 2007-09-06). > > > > In both cases the exact choice of 8192 is rather arbitrary, e.g. for > > commit buffers I think 1024 or 2048 would probably be a better > > default (this commit message is getting this commit close to the > > former, but I daresay it's already way above the average for git > > commits). > > Yes, they are arbitrary within the context of these callers. > > I do not think using STRBUF_HINT_SIZE macro in them is the right > thing to do at all, as there is no reason to think that the best > value for the write chunk sizes in these codepath has any linkage to > the best value for the read chunk sizes used by strbuf_read() at > all. When benchmarking reveals that the best default size for > strbuf_read() is 16k, you'd update STRBUF_HINT_SIZE to 16k, but how > do you tell that it also happens to be the best write buffer size > for the cache-tree writeout codepath (answer: you don't)? Being cc'd on this series, I feel compelled to respond with some review. But I'm in such agreement with what you said here (and downthread, and also in your response to patch 1) that I can only add a lame "me too". :) -Peff