From reviews-return-78468-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Sun Jun 3 01:25:39 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 2CBFA18B8B for ; Sun, 3 Jun 2018 01:25:39 +0000 (UTC) Received: (qmail 66655 invoked by uid 500); 3 Jun 2018 01:25:39 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 66620 invoked by uid 500); 3 Jun 2018 01:25:39 -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 66609 invoked by uid 99); 3 Jun 2018 01:25:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jun 2018 01:25:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id EDF52C0026; Sun, 3 Jun 2018 01:25:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-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-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id vOS8--jUb1nw; Sun, 3 Jun 2018 01:25:36 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 1E9125F1E6; Sun, 3 Jun 2018 01:25:36 +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 674E5E0016; Sun, 3 Jun 2018 01:25:35 +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 0B80AC4010A; Sun, 3 Jun 2018 01:25:34 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============5162407431817313947==" MIME-Version: 1.0 Subject: Re: Review Request 67369: Introduced a weighted shuffle algorithm implementation. From: Benjamin Mahler To: Meng Zhu , Gaston Kleiman , Greg Mann Cc: Benjamin Mahler , mesos Date: Sun, 03 Jun 2018 01:25:34 -0000 Message-ID: <20180603012534.23879.35473@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/67369/ X-Sender: Benjamin Mahler References: <20180531194750.38603.5883@reviews-vm2.apache.org> In-Reply-To: <20180531194750.38603.5883@reviews-vm2.apache.org> X-ReviewBoard-Diff-For: src/master/allocator/sorter/random/utils.hpp Reply-To: Benjamin Mahler X-ReviewRequest-Repository: mesos --===============5162407431817313947== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On May 31, 2018, 7:47 p.m., Meng Zhu wrote: > > src/master/allocator/sorter/random/utils.hpp > > Lines 53-59 (patched) > > > > > > Why do we need to construct the random distribution every time? How about: > > > > ``` > > std::uniform_real_distribution<> dis(0.0, 1.0); > > for (...) { > > ... > > keys[i] = 0.0 - std::pow(dis(urbg), (1.0 / weights[i])); > > } > > ``` It seemed a little more readable to me, and I assumed the cost was very low (e.g. no memory allocation). Would be good to pull it out if that's not the case! - Benjamin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/67369/#review204090 ----------------------------------------------------------- On May 30, 2018, 12:55 a.m., Benjamin Mahler wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/67369/ > ----------------------------------------------------------- > > (Updated May 30, 2018, 12:55 a.m.) > > > Review request for mesos, Gaston Kleiman, Greg Mann, and Meng Zhu. > > > Bugs: MESOS-8936 > https://issues.apache.org/jira/browse/MESOS-8936 > > > Repository: mesos > > > Description > ------- > > This will be used by the random sorter in order to support weights. > > > Diffs > ----- > > src/Makefile.am b7184ceccef5f2e985d905c155156f95c7a7c7b4 > src/master/allocator/sorter/random/utils.hpp PRE-CREATION > > > Diff: https://reviews.apache.org/r/67369/diff/1/ > > > Testing > ------- > > Test added in subsequent patch. > > > Thanks, > > Benjamin Mahler > > --===============5162407431817313947==--