leerho commented on issue #718:
URL: 
https://github.com/apache/datasketches-java/issues/718#issuecomment-3801676925

   [Introsort](https://en.wikipedia.org/wiki/Introsort) is the well-known 
algorithm that this code is modeled after.
   If understanding the purpose of this method is the issue, beyond the 
code-comments that are already there, you could also reference the wikipedia 
article. 
   
   The algorithm expressed in the code is more general than the simple form 
shown in the Wikipedia article as it allows for performing the operation on a 
portion of the passed in array.  **Yes**, in this particular case, the way CPC 
is using this method you could simplify the method arguments to just passing in 
the source array.
   
   However, because this is a general-purpose, stand alone sort algorithm 
complete with optional validity checking code, it would be a good candidate to 
place in the common.Utils class adding a second call signature using only the 
array that passes to this one.  This would make it available and more visible 
to other uses.  
   
   Another option for you: Just add another call signature above this one that 
just uses the array parameter.  Because these are static final methods the C2 
compiler (for Java anyway) will likely inline the two call signatures.
   
   It is my guess that when Keven Lang wrote this, he wasn't sure whether he 
would need the more generic form or not and went to the effort to generalize 
it.  This is good work, I hate to just delete that effort.
   
   I'm not opposing your suggestion, just offering some options to think about. 
:)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to