From nobody Thu Apr 25 11:35:37 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560429036; cv=none; d=zoho.com; s=zohoarc; b=PK2j4rIScqr4Xr3ymXbLlxeeHcD5AtmlATDsm35p9jYCKIV5hZXXENc1Zro13tHJP3rvzzkAniLh2Td9l1qrry9kFvyELo7UkPWKr6DChMxaqLmruofOvoCVX5KNOnexB5+jiXhLzUw1Dl+ZyJWmna768W8KaeThdMu4eaz337g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560429036; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=nsjKEQgJfqiB06g0P8XiBFq3ncgjV+hkXMY2rHTQJxk=; b=SBUH7/D1PrahKRBcIsYkemVILPWNI40lSIphe7CCuAlc9eC8+Mw56ObKoogl3W+09B9UFV8DMM6yY0wODi5HEXaCoyZ7qeusDaNTndUzXlxBeZboHhfog2Fj2JbjvW4jgOdZzam9irPHHwfilrcMLSd2b90ayS7Y2qGLN1MWTzg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560429036268979.3098308670583; Thu, 13 Jun 2019 05:30:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05CB930C1208; Thu, 13 Jun 2019 12:30:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFECE60BE2; Thu, 13 Jun 2019 12:30:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E597318521DE; Thu, 13 Jun 2019 12:30:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5DCS8on021880 for ; Thu, 13 Jun 2019 08:28:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5334078385; Thu, 13 Jun 2019 12:28:08 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-69.ams2.redhat.com [10.36.112.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF0F478387 for ; Thu, 13 Jun 2019 12:28:05 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 13 Jun 2019 14:28:04 +0200 Message-Id: <20190613122804.5046-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] do not go through each updated series many times X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 13 Jun 2019 12:30:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When a series consists of many patches and they are (as it almost always happens) merged in a single batch, series_update has quadratic complexity. Fix that by using a set. Signed-off-by: Paolo Bonzini --- api/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/models.py b/api/models.py index 81bc167..059eaeb 100644 --- a/api/models.py +++ b/api/models.py @@ -306,7 +306,7 @@ class Project(models.Model): project_head =3D property(get_project_head, set_project_head) =20 def series_update(self, message_ids): - updated_series =3D [] + updated_series =3D set() for msgid in message_ids: if msgid.startswith("<") and msgid.endswith(">"): msgid =3D msgid[1:-1] @@ -319,7 +319,7 @@ class Project(models.Model): mo.save() s =3D mo.get_series_head() if s: - updated_series.append(s) + updated_series.add(s) for series in updated_series: for p in series.get_patches(): if not p.is_merged: --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel