You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2019/05/12 08:54:50 UTC

svn commit: r1859133 - in /jmeter/trunk: src/components/org/apache/jmeter/timers/PoissonRandomTimer.java xdocs/changes.xml

Author: fschumacher
Date: Sun May 12 08:54:50 2019
New Revision: 1859133

URL: http://svn.apache.org/viewvc?rev=1859133&view=rev
Log:
Slight performance improvement in PoissonRandomTimer by using ThreadLocalRandom.

Based on a patch by Xia Li.

Closes #457

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/timers/PoissonRandomTimer.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/timers/PoissonRandomTimer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/timers/PoissonRandomTimer.java?rev=1859133&r1=1859132&r2=1859133&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/timers/PoissonRandomTimer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/timers/PoissonRandomTimer.java Sun May 12 08:54:50 2019
@@ -19,6 +19,7 @@
 package org.apache.jmeter.timers;
 
 import java.io.Serializable;
+import java.util.concurrent.ThreadLocalRandom;
 
 import org.apache.jmeter.util.JMeterUtils;
 
@@ -335,7 +336,7 @@ public class PoissonRandomTimer extends
         double p = 1;
         do {
             k = k + 1;
-            double u = Math.random();
+            double u = ThreadLocalRandom.current().nextDouble();
             p = p * u;
         } while (p > L);
         return k - 1;
@@ -358,7 +359,7 @@ public class PoissonRandomTimer extends
             if (n < 0){
                 continue;
             }
-            double v = Math.random();
+            double v = ThreadLocalRandom.current().nextDouble();
             double y = alpha - beta*x;
             double lhs = y + Math.log(v/Math.pow(1.0 + Math.exp(y),2));
             double rhs = k + n*Math.log(lambda) -logFactorial(n);

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1859133&r1=1859132&r2=1859133&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun May 12 08:54:50 2019
@@ -99,6 +99,7 @@ to view the last major behaviors with th
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>
 <ul>
   <li><bug>62863</bug>Enable PKCS11 keystores for usage with KeyStore Manager. Based on patch by Clifford Harms (clifford.harms at gmail.com).</li>
+  <li><pr>457</pr>Slight performance improvement in PoissonRandomTimer by using ThreadLocalRandom. Based on a patch by Xia Li.</li>
 </ul>
 
 <h3>Functions</h3>
@@ -179,6 +180,7 @@ to view the last major behaviors with th
 <ul>
   <li>Clifford Harms (clifford.harms at gmail.com)</li>
   <li><a href="https://ubikloadpack.com">Ubik Load Pack</a></li>
+  <li>Xia Li</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter.</p>
 <ul>