From reviews-return-82791-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Wed Oct 17 00:24:08 2018 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1FDC8198DA for ; Wed, 17 Oct 2018 00:24:08 +0000 (UTC) Received: (qmail 91234 invoked by uid 500); 17 Oct 2018 00:24:08 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 91199 invoked by uid 500); 17 Oct 2018 00:24:08 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 91187 invoked by uid 99); 17 Oct 2018 00:24:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2018 00:24:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E6A8CC6933; Wed, 17 Oct 2018 00:24:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.7 X-Spam-Level: X-Spam-Status: No, score=0.7 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 688Y2llq5dSQ; Wed, 17 Oct 2018 00:24:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 091C35F43C; Wed, 17 Oct 2018 00:24:06 +0000 (UTC) Received: from reviews.apache.org (unknown [10.41.0.12]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id BB54EE00E1; Wed, 17 Oct 2018 00:24:05 +0000 (UTC) Received: from reviews-vm2.apache.org (localhost [IPv6:::1]) by reviews.apache.org (ASF Mail Server at reviews-vm2.apache.org) with ESMTP id 8E973C41BA8; Wed, 17 Oct 2018 00:24:05 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============7069952968011300465==" MIME-Version: 1.0 Subject: Re: Review Request 69032: Optimized resources filter operation. From: Benjamin Mahler To: =?utf-8?q?Gast=C3=B3n_Kleiman?= , Benjamin Mahler Cc: Meng Zhu , mesos Date: Wed, 17 Oct 2018 00:24:05 -0000 Message-ID: <20181017002405.39668.31523@reviews-vm2.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Benjamin Mahler X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/69032/ X-Sender: Benjamin Mahler X-ReviewBoard-ShipIt: 1 References: <20181016231601.39640.59556@reviews-vm2.apache.org> In-Reply-To: <20181016231601.39640.59556@reviews-vm2.apache.org> Reply-To: Benjamin Mahler X-ReviewRequest-Repository: mesos --===============7069952968011300465== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/69032/#review209669 ----------------------------------------------------------- Ship it! Can you also post the filter benchmark results? https://github.com/apache/mesos/blob/1.7.0/src/tests/resources_tests.cpp#L3865-L3920 src/common/resources.cpp Line 1550 (original), 1550 (patched) Consider reserving the result vector? src/common/resources.cpp Line 1555 (original), 1555 (patched) Probably warrants a comment about why we just add it to the vector instead of adding? - Benjamin Mahler On Oct. 16, 2018, 11:16 p.m., Meng Zhu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/69032/ > ----------------------------------------------------------- > > (Updated Oct. 16, 2018, 11:16 p.m.) > > > Review request for mesos, Benjamin Mahler and Gastón Kleiman. > > > Bugs: MESOS-9325 > https://issues.apache.org/jira/browse/MESOS-9325 > > > Repository: mesos > > > Description > ------- > > Currently, `Resources::filter()` operation uses `add()` which > scans the resources vector, a O(n) operation. This is not > necessary. `filter()` operation should only remove `Resource` > entires. This patch optimizes the performance by directly > `push_back` the resource to the vector without scanning. > > > Diffs > ----- > > src/common/resources.cpp f0f3df579550d874e477e2d6e7d0e87df079358a > src/v1/resources.cpp 4d2b64f6e30ef96b47fc0b72b00158864e245650 > > > Diff: https://reviews.apache.org/r/69032/diff/1/ > > > Testing > ------- > > make check > > > Thanks, > > Meng Zhu > > --===============7069952968011300465==--