Github user parthchandra commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1214#discussion_r183909850
  
    --- Diff: common/src/main/java/org/apache/drill/common/Stopwatch.java ---
    @@ -0,0 +1,186 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.common;
    +
    +import com.google.common.base.Ticker;
    +
    +import java.util.concurrent.TimeUnit;
    +
    +/**
    + * Helper that creates stopwatch based if debug level is enabled.
    --- End diff --
    
    Do we really need this? In general we have (or should have) used Stopwatch 
to track metrics and or performance bottlenecks in production. In neither case 
do we want to enable debug.
    Also, for debugging performance issues (I see that the places you've 
changed to use this Stopwatch are places where we encountered performance 
issues), would it be better to use 
    ```
    Stopwatch timer;
    if(logger.isDebugEnabled()){
       timer = Stopwatch.createStarted();
    }
    ```
    More verbose, but guaranteed to be optimized away by the JVM.
    Not insisting that we change this, BTW.


---

Reply via email to