<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
  <title>the all-thing</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="/static/style.css" type="text/css" />
  <link rel="alternate" type="application/rss+xml" title="the all-thing RSS feed" href="/index.rss" />
  <link rel="alternate" type="text/plain" title="the all-thing in plain text" href="/index.txt" />
  <script type="text/javascript" src="/static/mootools.js"></script>
  <script type="text/javascript" src="http://music.masanjin.net:9292/waxiest.js"></script>
</head>
<body>

<div id="main">
  <div id="header">
    <h1><a  href="/">the all-thing</a></h1>
    
      <p>Showing only posts labeled "benchmarks" (<a  href="/label/benchmarks.rss">rss</a>). <a  href="/index/">See all posts</a>.</p>
    
  </div>
  <div id="sidebar">
    <h3>Recent comments</h3>

    <ul class="sidebar-list">
    
    <li><b><a  href="/whisper-0.5#58174069c046a78e55f02ef81da81e74">Dominique Julia</a></b>
        <i><a  href="/whisper-0.5">Whisper 0.5 released</a></i>
           one week ago
    </li>
    
    <li><b><a  href="/ruby-ncurses-and-thread-blocking#8fa2a0f392d7c0562d630e4936407c11">William Morgan</a></b>
        <i><a  href="/ruby-ncurses-and-thread-blocking">Ruby, Ncurses and blocked threads</a></i>
           three months ago
    </li>
    
    <li><b><a  href="/git-wtf-bf06ab7-released#533654a7a229569e27a6d0afd716c444">William Morgan</a></b>
        <i><a  href="/git-wtf-bf06ab7-released">git wtf bf06ab7 released</a></i>
           three months ago
    </li>
    
    <li><b><a  href="/git-wtf-bf06ab7-released#b7b7a905477674eb6985b34a964a0dca">Joao Nelas</a></b>
        <i><a  href="/git-wtf-bf06ab7-released">git wtf bf06ab7 released</a></i>
           three months ago
    </li>
    
    <li><b><a  href="/ruby-ncurses-and-thread-blocking#b00001114360ac152f87d4ac2a6e0c5b">Ollivier Robert</a></b>
        <i><a  href="/ruby-ncurses-and-thread-blocking">Ruby, Ncurses and blocked threads</a></i>
           three months ago
    </li>
    
    </ul>

    <h3>Authors</h3>
    <ul class="sidebar-list">
    
      <li><a class="author" href="/by/William+Morgan/">William&nbsp;Morgan</a>&nbsp;(65) </li>
    
    </ul>

    <h3>Tags</h3>
    <ul class="sidebar-list">
    
      <li><a class="label" href="/label/releases/">releases</a>&nbsp;(15) </li>
    
      <li><a class="label" href="/label/whisper/">whisper</a>&nbsp;(13) </li>
    
      <li><a class="label" href="/label/git/">git</a>&nbsp;(9) </li>
    
      <li><a class="label" href="/label/stats/">stats</a>&nbsp;(8) </li>
    
      <li><a class="label" href="/label/trollop/">trollop</a>&nbsp;(6) </li>
    
      <li><a class="label" href="/label/ruby/">ruby</a>&nbsp;(6) </li>
    
      <li><a class="label" href="/label/sup/">sup</a>&nbsp;(6) </li>
    
      <li><a class="label" href="/label/git-wtf/">git-wtf</a>&nbsp;(4) </li>
    
      <li><a class="label" href="/label/vm/">vm</a>&nbsp;(4) </li>
    
      <li><a class="label" href="/label/mathml/">mathml</a>&nbsp;(3) </li>
    
      <li><a class="label" href="/label/continuations/">continuations</a>&nbsp;(3) </li>
    
      <li><a class="label" href="/label/ditz/">ditz</a>&nbsp;(3) </li>
    
      <li><a class="label" href="/label/proglang/">proglang</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/optimization/">optimization</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/benchmarks/">benchmarks</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/rubinius/">rubinius</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/inlining/">inlining</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ubuntu/">ubuntu</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/fibers/">fibers</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ritex/">ritex</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ruby1.9/">ruby1.9</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ncurses/">ncurses</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/javascript/">javascript</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/media/">media</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/vim/">vim</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/classification/">classification</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/massachusetts/">massachusetts</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/greasemonkey/">greasemonkey</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/wine/">wine</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/readme/">readme</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/ancient-greek/">ancient-greek</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/web/">web</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/current+events/">current&nbsp;events</a>&nbsp;(1) </li>
    
    </ul>

    <h3>Other formats</h3>
    <ul class="sidebar-list">
    <li><a href="/index.rss"><img src="/static/rss-badge.png"/></a></li>
    <li><a href="/index.txt">plain text version</a></li>
    </ul>

    <h3 class="waxiest.author.original">Who is this man?</h3>
    <h3 class="waxiest.author.beautiful" style="display:none">I must find out more about this beautiful creature</h3>
    <h3 class="waxiest.author.beautifulbig" style="display:none">I MUST FIND OUT MORE ABOUT THIS BEAUTIFUL CREATURE</h3>
    <h3 class="waxiest.author.originalbig" style="display:none">WHO IS THIS MAN?</h3>

    <script type="text/javascript">
      var w = waxiest();
      w.optimizeHTMLSection("author", ["original", "beautiful", "beautifulbig", "originalbig"]);
    </script>

    <a href="http://masanjin.net" onClick="w.goalReached('greeting')">William Morgan</a>
  </div>
  <div id="content">
    
  <h2><a  href="/whisper-benchmarks">Whisper benchmarks</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="12 months ago">March  6, 2009  5:54pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/benchmarks/">benchmarks</a></span> </div>
  
  <p class='first'>I&#8217;ve done some benchmarking on Whisper. Here are the results, with
a few points of comparison:</p>
<table>
	<tr>
		<th>system </th>
		<th>req/s </th>
		<th>ms/req </th>
		<th>delta ms/req </th>
	</tr>
	<tr>
		<td> nginx static </td>
		<td style="text-align:right;">13736.04 </td>
		<td style="text-align:right;">7.280 </td>
		<td> </td>
	</tr>
	<tr>
		<td> rack/thin </td>
		<td style="text-align:right;">3065.24 </td>
		<td style="text-align:right;">32.624 </td>
		<td style="text-align:right;">25.344 </td>
	</tr>
	<tr>
		<td> whisper/no logging  </td>
		<td style="text-align:right;">1918.56 </td>
		<td style="text-align:right;">52.123 </td>
		<td style="text-align:right;">19.499 </td>
	</tr>
	<tr>
		<td> whisper  </td>
		<td style="text-align:right;">1833.40 </td>
		<td style="text-align:right;">54.544 </td>
		<td style="text-align:right;">2.421 </td>
	</tr>
</table>
<p><em>Nginx static</em> is nginx serving a static file. We see it can handle 13k
requests per second, and takes about 7ms for a single request. If we add
a simple Thin server on top of that, going through Rack, we immediately
drop requests/second by an order of magnitude, and it takes us an extra
25ms/request. That&#8217;s the cost of using Ruby.</p>
<p>Adding Whisper on top of that requires another 19.5 ms/requests,
bringing our rate down to 1919 requests/second, or over 7 times slower
than Nginx serving static files. And if you want logging with that, add
another 2.4 ms/request.</p>
<p>That 2.4ms/request is interesting, because it&#8217;s basically the result of
a few puts statements. Yes, Ruby is expensive. The bare Rack/Thin
performance shows the headroom I have on the Ruby side (i.e. without
rewriting the whole thing in C). If a puts is that expensive, then
stripping out a couple debugging statements and caching some regexp
results would probably result in a very noticable improvement in
performance.</p>
<p>But how many requests/second do you need to be able to survive being
Slashdotted? A brief web search suggests a high estimate of &#8220;several
hundred&#8221;. Let&#8217;s say that means 300 req/s. That means that Whisper is
already 6 times the Slashdot effect requirement. So it&#8217;s almost definitely not
worth complicated the code for the sake of performance.</p>
<p>Experiment parameters: these are all tests using <code>ab</code> (the Apache
benchmark tool) with 100 concurrent requests, averaged over 50k
requests. The tests were performed by connecting to localhost (i.e.
going over the network stack but not over the network itself), on a
quad-core Intel 2Ghz (Q8200) running 64-bit Linux 2.6.27. <span class="caps">YMMV</span>.</p>
  <div class="comment-link">
    
    <a  href="/whisper-benchmarks#comments">No comments</a>.
  </div>

  <h2><a  href="/old38">Preliminary Rubinius inliner benchmarks</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="21 months ago">June  6, 2008  7:40pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/rubinius/">rubinius</a></span> <span class='label'><a  href="/label/inlining/">inlining</a></span> <span class='label'><a  href="/label/benchmarks/">benchmarks</a></span> </div>
  
  <p class='first'>I&#8217;ve done some very preliminary benchmarking on the inliner I&#8217;ve been hacking
into Rubinius.</p>
<p>For the very simple case it can handle so far—guaranteed dispatch to self,
fixed number of arguments (no splats or defaults), no blocks—here&#8217;s what we get
for 10m iterations of a simple function calling another simple function:</p>
<table>
	<tr>
		<th>name </th>
		<th>user </th>
		<th>system </th>
		<th>total </th>
		<th>real </th>
	</tr>
	<tr>
		<td> uninlined-no-args </td>
		<td style="text-align:right;">22.49 </td>
		<td style="text-align:right;">0 </td>
		<td style="text-align:right;">22.49 </td>
		<td style="text-align:right;">22.49 </td>
	</tr>
	<tr>
		<td> inlined-no-args   </td>
		<td style="text-align:right;">21.74 </td>
		<td style="text-align:right;">0 </td>
		<td style="text-align:right;">21.74 </td>
		<td style="text-align:right;">21.74 </td>
	</tr>
	<tr>
		<td> uninlined-4-args  </td>
		<td style="text-align:right;">27.74 </td>
		<td style="text-align:right;">0 </td>
		<td style="text-align:right;">27.74 </td>
		<td style="text-align:right;">27.74 </td>
	</tr>
	<tr>
		<td> inlined-4-args    </td>
		<td style="text-align:right;">24.59 </td>
		<td style="text-align:right;">0 </td>
		<td style="text-align:right;">24.59 </td>
		<td style="text-align:right;">24.59 </td>
	</tr>
</table>
<p>So inlining results in a 3.5% speedup on method dispatch with no arguments, and
a 12.8% speedup when there are four arguments.</p>
<p>Of course this is the very optimal case for the inliner. Guaranteed dispatch to
self means that I don&#8217;t even add any guard code, which would definitely slow
things down. But this actually is a fairly common case that occurs whenever you
use self accessors and any helper functions that don&#8217;t have blocks or varargs.</p>
<p>And the real boost of inlining, presumably, is going to be in conjunction with
<span class="caps">JIT</span>, since the <span class="caps">CPU</span> can pipeline the heck out of everything.</p>
  <div class="comment-link">
    
    <a  href="/old38#comments">No comments</a>.
  </div>




  </div>

  <div id="footer" style="margin: 0px;">
    Served up by <a href="http://masanjin.net/whisper/">Whisper</a>. Yes!
  </div>
</div>
</body>
</html>
