From issues-return-69799-archive-asf-public=cust-asf.ponee.io@commons.apache.org Sat Sep 22 19:52:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8DF2018065B for ; Sat, 22 Sep 2018 19:52:04 +0200 (CEST) Received: (qmail 4401 invoked by uid 500); 22 Sep 2018 17:52:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 4390 invoked by uid 99); 22 Sep 2018 17:52:03 -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; Sat, 22 Sep 2018 17:52:03 +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 0F7EFC00A9 for ; Sat, 22 Sep 2018 17:52:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] 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 Cn18CPYMhd1o for ; Sat, 22 Sep 2018 17:52:02 +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 872365F3B2 for ; Sat, 22 Sep 2018 17:52:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id CEE25E25AA for ; Sat, 22 Sep 2018 17:52:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 434FF23FA3 for ; Sat, 22 Sep 2018 17:52:00 +0000 (UTC) Date: Sat, 22 Sep 2018 17:52:00 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (RNG-51) PoissonSampler single use speed improvements using a cache MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/RNG-51?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:all-tabpanel ] Gilles resolved RNG-51. ----------------------- Resolution: Implemented Fix Version/s: 1.2 commit 5e62c08f7449020b8ddc67725afc759980557c51 > PoissonSampler single use speed improvements using a cache > ---------------------------------------------------------- > > Key: RNG-51 > URL: https://issues.apache.org/jira/browse/RNG-51 > Project: Commons RNG > Issue Type: Improvement > Affects Versions: 1.1 > Reporter: Alex D Herbert > Priority: Minor > Labels: performance > Fix For: 1.2 > > > This improvement is a follow on from=C2=A0RNG-50. > That improved the PoissonSampler by splitting it into two samplers for th= e different algorithms (SmallMeanPoissonSampler and LargeMeanPoissonSampler= ) and moving initialisation computations from the sample method into the co= nstructor. This improved the speed of repeat use of the same sampler by up = to 3-fold. It does not effect single-use of a sampler. > In the case of the LargeMeanPoissonSampler the initialisation 'state' com= puted within the constructor involves 2 Math.log, 2 Math.exp, 2 Math.sqrt a= nd 1 logFactorial computations. If the sampler is used to generate only 1 s= ample then the cost of computing the state is a significant portion of the = sample time. > However the state is not unique to the mean of the Poisson distribution b= ut the {{(int)Math.floor(mean)}}. This means the initialisation state can b= e shared and reused by PoissonSamplers with different means. > This was demonstrated using a JMH benchmark speed test comparing the stan= dard PoissonSampler verses a PoissonSamplerCache that can store the initial= isation state of the PoissonSampler. > For single-use Poisson samples with a mean within a known range the cache= can provide 1.3 to 2x speed-up as initialisation state can be reused. > The original benchmark was performed using Version 1.0. The Version 1.1. = samplers use a new faster Gaussian sampler internally. So the benchmark sho= uld be repeated for Version 1.1. > The test project containing the V1.0 JMH benchmark is here: [poisson-samp= ler-test-code|https://github.com/aherbert/poisson-sampler-test-code] > I propose to update this project to reference V1.1 of Commons RNG and rep= eat the test of the PoissonSamplerCache. Results will be posted when availa= ble.=20 -- This message was sent by Atlassian JIRA (v7.6.3#76005)