<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rniwa&#64;webkit.org" title="Ryosuke Niwa &lt;rniwa&#64;webkit.org&gt;"> <span class="fn">Ryosuke Niwa</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add a script to automate browser based performance benchmarks (e.g. Speedometer and JetStream)"
   href="https://bugs.webkit.org/show_bug.cgi?id=144038">bug 144038</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #251599 Flags</td>
           <td>review?
           </td>
           <td>review-
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add a script to automate browser based performance benchmarks (e.g. Speedometer and JetStream)"
   href="https://bugs.webkit.org/show_bug.cgi?id=144038#c18">Comment # 18</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add a script to automate browser based performance benchmarks (e.g. Speedometer and JetStream)"
   href="https://bugs.webkit.org/show_bug.cgi?id=144038">bug 144038</a>
              from <span class="vcard"><a class="email" href="mailto:rniwa&#64;webkit.org" title="Ryosuke Niwa &lt;rniwa&#64;webkit.org&gt;"> <span class="fn">Ryosuke Niwa</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=251599&amp;action=diff" name="attach_251599" title="Patch">attachment 251599</a> <a href="attachment.cgi?id=251599&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=251599&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=251599&amp;action=review</a>

<span class="quote">&gt; Tools/ChangeLog:7
&gt; +</span >

You should add a description as to what you're adding.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/README.md:87
&gt; +    * **result_wrapper**: the wrapper module you want to wrap the results. Current availble option is &quot;MergeResultWrapper&quot;. To customize your own result wrapper, extends Utilities/ResultWrapper/BaseResultWrapper.py and register your module in Utilities/ResultWrapper/ResultWrapper.json</span >

I really don't like that this is an option.  It's a code smell to have generalization we don't need right now.
It's always better to implement the bare minimum we need and generalize things as needed.
Otherwise, we'll end up extra layers of abstractions and configurations we don't need and cause a maintenance nightmare down the road.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py:54
&gt; +                self.browserDriver.launchUrl(self.composeUrl(self.httpServerDriver.baseUrl(), benchmark['entry_point']), self.buildDir)</span >

Why don't we just use urlparse.urljoin?
<a href="https://docs.python.org/2/library/urlparse.html">https://docs.python.org/2/library/urlparse.html</a>

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py:66
&gt; +                        self.browserDriver.closeBrowsers()
&gt; +                        _log.error('No result. Something went wrong')
&gt; +                    self.browserDriver.closeBrowsers()</span >

Why do we need to call closerBrowsers twice when result is None?
It seems like we just want to call it once.
Also, it seems like checking None-ness of result here seems strange.
Why don't we just put &quot;_log.error('No result. Something went wrong')&quot; in &quot;except:&quot; clause instead?

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py:74
&gt; +    &#64;classmethod
&gt; +    def composeUrl(cls, baseUrl, relativePath):
&gt; +        return '/'.join([baseUrl, relativePath])</span >

We don't this function if we used urlparse.urljoin above.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py:81
&gt; +                fp.write(json.dumps(results))</span >

json.dump(results, fp) will be more efficient.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py:84
&gt; +            _log.info('Cannot open output file: %s' % outputFile)
&gt; +            _log.info('Results are:\n %s', json.dumps(results))</span >

These should be errors.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py:16
&gt; +    if not drivers:
&gt; +        raise Exception(&quot;No driver was found in %s&quot; % (driverFileName))</span >

Why don't we just do &quot;assert drivers&quot; instead of repeating the exception message twice?

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_drivers.json:17
&gt; +    &quot;ios&quot;: {
&gt; +         &quot;safari&quot;: {
&gt; +            &quot;moduleName&quot;: &quot;iOSSafariDriver&quot;, 
&gt; +            &quot;filePath&quot;: &quot;browser_driver.ios_safari_driver&quot;
&gt; +        }
&gt; +    } </span >

Does this thing exist? It seems that shouldn't have this entry if this patch doesn't include iOS implementation.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:24
&gt; +    parser = argparse.ArgumentParser(
&gt; +        description='python TwistedHTTPServer.py webroot')</span >

Why don't we put this into a single line?

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:29
&gt; +            self.ip = [
&gt; +                ip for ip in socket.gethostbyname_ex(
&gt; +                    socket.gethostname())[2] if not ip.startswith(&quot;127.&quot;)][0]</span >

This hsould all be in a single line.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:33
&gt; +        except:
&gt; +            _log.error('Cannot get the ip address of current machine')
&gt; +            raise</span >

Please pass the original exception object to raise as in:
except Exception:

    raise Exception
so that we get to see the original error.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:49
&gt; +                    self.serverPort = psutil.Process(
&gt; +                        self.serverProcess.pid).connections()[0][3][1]</span >

Please put this in single line.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:70
&gt; +                    except ValueError:
&gt; +                        pass
&gt; +                    except IndexError:
&gt; +                        pass</span >

Perhaps we should add comments about why we're ignoring these errors.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:75
&gt; +            except:
&gt; +                raise</span >

Pleaes don't do this.  This will prevent us from seeing the actual error.

<span class="quote">&gt; Tools/Scripts/webkitpy/benchmark_runner/result_wrapper/base_result_wrapper.py:9
&gt; +from abc import abstractmethod
&gt; +
&gt; +
&gt; +class BaseResultWrapper(object):
&gt; +    &#64;abstractmethod
&gt; +    def wrap(self, results):
&gt; +        pass</span >

I really don't think we should have this abstract class.
I can't think of any use case in which another implementation of merging results is needed.
The fact the type of results &quot;wrapper&quot; needs to be specified in the plan is an extra annoynace that's unwarrented.
r- because of this.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>