You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by "leerho (via GitHub)" <gi...@apache.org> on 2023/05/03 17:16:33 UTC

[GitHub] [datasketches-java] leerho commented on a diff in pull request #440: This commit fixes all the SpotBugs 4.7.3 issues.

leerho commented on code in PR #440:
URL: https://github.com/apache/datasketches-java/pull/440#discussion_r1183991917


##########
src/main/java/org/apache/datasketches/req/ReqCompactor.java:
##########
@@ -49,7 +49,6 @@ class ReqCompactor {
   //objects
   private FloatBuffer buf;
   private final ReqDebug reqDebug = null;
-  private Random rand;

Review Comment:
   Actually, it was complaining that an instance of Random was created and then used only once.  This is not only slow, but it does not produce good random behavior.  
   
   So I took a hard look at how Random was used in REQ and refactored the use of Random in REQ completely.  Now, Random is instantiated once in ReqSketch and then a reference to it is passed to the ReqCompactor.compact(...) method which then uses the same random instance for every compaction.  This also opens the door for us to easily add a "makeDeterministic" flag to the public constructor if we decide we want to do that (which I am increasing thinking that this would be ok to do).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org