Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/738#discussion_r99712636
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
 ---
    @@ -77,12 +77,14 @@
        */
       public static String getPrettyDuration(long startTimeMillis, long 
endTimeMillis) {
         long durationInMillis = (startTimeMillis > endTimeMillis ? 
System.currentTimeMillis() : endTimeMillis) - startTimeMillis;
    -    long hours = TimeUnit.MILLISECONDS.toHours(durationInMillis);
    +    long days = TimeUnit.MILLISECONDS.toDays(durationInMillis);
    --- End diff --
    
    The cost of initializing an object is trivial. Unless we are in critical 
performance code, code clarity and simplicity is more important than a few 
object creations. Indeed, in the code below, each time we do a
    ```
    stringA + stringB
    ```
    We create a temporary String object. So, we are already creating a large 
collection of objects.
    
    The question is really 1) code repetition (not duplicating the code to 
split out fields) and 2) ease-of-use (making it easy to use the duration format 
utility.)
    
    Thanks for combining this code into a utility. Once committed, I will 
shamelessly reuse the code to replace the hacks I've used for displaying 
durations.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to