From owner-dev-commits-src-all@freebsd.org Mon Jun 14 12:10:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD41565C6E5; Mon, 14 Jun 2021 12:10:01 +0000 (UTC) (envelope-from SRS0=xEBg=LI=sigsegv.be=kristof@codepro.be) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G3Vd466Knz4mHj; Mon, 14 Jun 2021 12:10:00 +0000 (UTC) (envelope-from SRS0=xEBg=LI=sigsegv.be=kristof@codepro.be) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 19D0438F02; Mon, 14 Jun 2021 14:09:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigsegv.be; s=mail; t=1623672598; bh=5Mrkc5b5sWpwLLILA5XqLecG7krQVUHGG+dnKqA6fKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=giq7cuYfh3f9EN1q//j+6I2BIcmIAGSQeLLYJEq3ioD4fTcfjsLgVdYLJUbykd2ue vOQ0XaoQjb2K6Rrl3nrPAIDXjxkJU4Mh0VnHgHiLgcU45Bo3nnIHtKdSsHeO2KDTGo oKXTH4zooc74MI9NYPMIwlshgKhykcf3VBA8AlFI= From: "Kristof Provost" To: "Mariusz Zaborski" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 89d5cbb82294 - main - libnv: optimize nvlist size calculation Date: Mon, 14 Jun 2021 14:09:57 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: <4EF64072-D94B-46FB-9AE9-321936DEEA7C@sigsegv.be> In-Reply-To: <202106111551.15BFpp8j055403@gitrepo.freebsd.org> References: <202106111551.15BFpp8j055403@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4G3Vd466Knz4mHj X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=sigsegv.be header.s=mail header.b=giq7cuYf; dmarc=pass (policy=none) header.from=sigsegv.be; spf=pass (mx1.freebsd.org: domain of SRS0=xEBg=LI=sigsegv.be=kristof@codepro.be designates 5.9.86.228 as permitted sender) smtp.mailfrom=SRS0=xEBg=LI=sigsegv.be=kristof@codepro.be X-Spamd-Result: default: False [-1.20 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[sigsegv.be:s=mail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip4:5.9.86.228]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[5.9.86.228:from:127.0.2.255]; DKIM_TRACE(0.00)[sigsegv.be:+]; DMARC_POLICY_ALLOW(-0.50)[sigsegv.be,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[kristof@sigsegv.be,SRS0=xEBg=LI=sigsegv.be=kristof@codepro.be]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[5.9.86.228:from]; ASN(0.00)[asn:24940, ipnet:5.9.0.0/16, country:DE]; FROM_NEQ_ENVFROM(0.00)[kristof@sigsegv.be,SRS0=xEBg=LI=sigsegv.be=kristof@codepro.be]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 12:10:01 -0000 On 11 Jun 2021, at 17:51, Mariusz Zaborski wrote: > The branch main has been updated by oshogbo: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D89d5cbb82294c8624e66f920d5035= 3057ccab14b > > commit 89d5cbb82294c8624e66f920d50353057ccab14b > Author: Mariusz Zaborski > AuthorDate: 2021-06-11 15:35:36 +0000 > Commit: Mariusz Zaborski > CommitDate: 2021-06-11 15:51:29 +0000 > > libnv: optimize nvlist size calculation > > If we had a multiple nvlist, during nvlist_pack, we calculated the = > size > of every nvlist separately. For example, if we had a nvlist with = > three > nodes each containing another (A contains B, and B contains C), we = > first > calculated the size of nvlist A (which contains B, C), then we = > calculate > the size of B (which contains C, notice that we already did the > calculation of B, when we calculate A), and finally C. This means = > that > this calculation was O(N!). This was done because each time we = > pack > nvlist, we have to put its size in the header > (the separate header for A, B, and C). > > To not break the ABI and to reduce the complexity of nvlist_size, > instead of calculating the nvlist size when requested, > we track the size of each nvlist. > > Reported by: pjd, kp > Tested by: kp Thanks for this! Do you object to this being MFCd in a few days? Thanks, Kristof