<!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 "whisper" (<a  href="/label/whisper.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-0.5">Whisper 0.5 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="9 months ago">May 20, 2009  4:48pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p class='first'>I&#8217;ve released <a href="http://masanjin.net/whisper/">Whisper</a> version 0.5. 
Lots of good stuff since 0.3 (I didn&#8217;t announce 0.4 because it was
a minor bugfix release):</p>
<ul>
	<li>Nested comments are now properly supported.</li>
	<li>New &lt;pre&gt; and &lt;poem&gt; blocks added.</li>
	<li>A new <code>whisper-process-email</code> command for manually reprocessing email.
  You can also offload all email processing to this program instead of the main
  Whisper server, if you like.</li>
	<li>New dependency for the 0.2 version of <a href="http://ritex.rubyforge.org/">RiTeX</a>, which
  has equation array support (see <a href="http://all-thing.net/ritex-0.2">announcement</a> for details).</li>
	<li>Better mbox-splitting code, now that I&#8217;ve figured out how to do this properly
  in <a href="http://sup.rubyforge.org/">Sup</a>.</li>
	<li>RiTeX macros now properly persist throughout an entry.</li>
	<li>Many other minor bugfixes: attribution lines in emails, various incorrect
  bits of <span class="caps">HTML</span> output, escaping of Ritex error messages, etc.</li>
</ul>
<p>Try it now!</p>
<ol>
	<li><code>sudo gem install whisper --source <a href='http://masanjin.net/'>http://masanjin.net/</a></code></li>
	<li><code>whisper-init &lt;blog directory&gt;</code></li>
	<li>Follow the instructions.</li>
</ol>
  <div class="comment-link">
    
    <a  href="/whisper-0.5#comments">One comment by <b>Dominique Julia</b></a>.
  </div>

  <h2><a  href="/suck-eggs">Teaching your grandmother to suck eggs</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="10 months ago">May  6, 2009  1:31pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ancient-greek/">ancient-greek</a></span> <span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/ubuntu/">ubuntu</a></span> </div>
  
  <p class='first'>If you&#8217;re reading <a href="http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php">a random diatribe on whether C and C++ are good for
numerical
computing</a>
and happen to come across the curious expression &#8220;teaching your grandmother to
suck eggs&#8221;, and decide to learn more about it, you&#8217;ll quickly find references
to early usages in the 1749 Henry Fielding novel, <cite><a href="http://en.wikipedia.org/wiki/The_History_of_Tom_Jones,_a_Foundling">Tom
Jones</a></cite>, in
which the protagonist recounts:</p>
<blockquote>
<p>I remember my old schoolmaster, who was a prodigious great scholar, used
often to say, Polly matete cry town is my daskalon. The English of which, he
told us, was, That a child may sometimes teach his grandmother to suck eggs.</p>
</blockquote>
<p>And if you then think to yourself, what the heck is &#8220;Polly matete cry town is
my daskalon&#8221;? you need only grab your handy copy of William Shepard Walsh&#8217;s
1909 <a href="http://books.google.com/books?id=hrJkAAAAMAAJ">Handy-book of literary curiosities</a>, look up &#8220;Polly
matete&#8221; in the index, and find that it&#8217;s the transliteration (transphoneticization?) of:</p>
<blockquote>
<p>πολλοι μαθηται κρειττονες διδασκαλον</p>
</blockquote>
<p>which is the last line of a Greek epigram attributed &#8220;sometimes to Phillippus of Thessalonica, sometimes to Lucilius (both of whom lived in the early days of the Roman Empire)&#8221;, translated as:</p>
<p><div class='poem-title'>On a Stolen Statue of Mercury</div><pre class='poem'>Hermes, the volatile, Arcady's president,
  Lacquey of deities, robber of herds,
In this gymnasium constantly resident,
  Light-fingered Aulus bore off with these words:
Many a scholar, by travelling faster
On learning's high-road, runs away with his master.</pre></p>
<p>So there you go. And if you&#8217;re wondering what the original phrase means, Walsh
provides this helpful explanatory rhyme:</p>
<p><pre class='poem'>Teach not a parent's mother to extract
  The embryo juices of an egg by suction:
The good old lady can the feat enact
  Quite irrespective of your kind instruction.</pre></p>
<p>As a side note, <a href="http://masanjin.net/whisper/">Whisper</a> now supports
poems, and I just learned how to type Greek in Ubuntu.</p>
  <div class="comment-link">
    
    <a  href="/suck-eggs#comments">One comment by <b>Mike Schuresko</b></a>.
  </div>

  <h2><a  href="/no-mathml-in-webkit">No MathML in webkit</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="11 months ago">March 19, 2009  1:07pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/mathml/">mathml</a></span> <span class='label'><a  href="/label/whisper/">whisper</a></span> </div>
  
  <p class='first'>So apparently <a href="http://webkit.org/projects/mathml/index.html">WebKit has no real MathML
support</a>. Empirically, it seems
like you get some stuff like greek symbols, but things like sums and whatnot
don&#8217;t appear. Oh well. Mac users, switch to Firefox, or ignore the math posts.</p>
  <div class="comment-link">
    
    <a  href="/no-mathml-in-webkit#comments">No comments</a>.
  </div>

  <h2><a  href="/whisper-0.3">Whisper 0.3 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="12 months ago">March 16, 2009  1:44pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p class='first'>I&#8217;ve released Whisper 0.3. This is mostly a bugfix release, with generally
better email support, including support for <span class="caps">MIME</span> multipart email.</p>
<p>How to do it:</p>
<ol>
	<li><code>sudo gem install whisper --source <a href='http://masanjin.net/'>http://masanjin.net/</a></code></li>
	<li><code>whisper-init &lt;blog directory&gt;</code></li>
	<li>Follow the instructions!</li>
</ol>
  <div class="comment-link">
    
    <a  href="/whisper-0.3#comments">No comments</a>.
  </div>

  <h2><a  href="/whisper-0.2">Whisper 0.2 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="12 months ago">March 11, 2009  9:06am</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p class='first'>I&#8217;ve released <a href="http://masanjin.net/whisper/">Whisper</a> 0.2. Beyond some minor
bugfixes, the big enhancement in this one is that the &#8220;post as micro mailing
list&#8221; idea now works. The comments on every post form a mailing list, with
everyone who commented auto-receiving everyone else&#8217;s comments, and all replies
being archived on the mailing list.</p>
<p>Of course you can set your reply settings on a per-comment basis to disable
this, or to restrict it to only send immediate replies to your comment. The
only thing you can&#8217;t do so far is change your settings (e.g. from all to none)
once you&#8217;ve made them. That will be coming later.</p>
<p>Still to go: trackbacks, I guess, and maaaaybe add textarea comments.</p>
<p>Get it: <code>sudo gem install whisper --source <a href='http://masanjin.net/'>http://masanjin.net/</a></code></p>
  <div class="comment-link">
    
    <a  href="/whisper-0.2#comments">Two comments by <b>John Henderson</b> and <b>William Morgan</b></a>.
  </div>

  <h2><a  href="/old-comments">Old comments are in</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="12 months ago">March  8, 2009  6:29pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/mathml/">mathml</a></span> </div>
  
  <p class='first'>I&#8217;ve finally pulled in all the old comments from the Blogspot blog. A painful
process of semi-automated Atom to YAML+Textile conversion, and the resulting
comments are not threaded, but they&#8217;re at least here now.</p>
<p>As a side note, I&#8217;m <strong>really</strong> liking having my posts stored in a git repo. I can
write them locally, tweak them and see how things look, and push when they&#8217;re
finally ready to be published.</p>
<p>As another side note, MathML is a being a shitshow as usual. Firefox 3.1 (but
not 3.0?) apparently craps out at embedded style sheets in <span class="caps">XML</span> (craps out as
in, refuses to display the blog and displays a big red error instead), or some
shit. So I&#8217;ve removed some stylesheet line from the master template and now
everything seems to work in both Firefoxes. But that line is <em>critical</em>
according to <cite><a href="http://www.w3.org/Math/XSL/">Putting mathematics on the Web with
MathML</a></cite> so god only knows what I&#8217;ve broken in the
process.</p>
<p>The big problem with all this MathML stuff is that the <span class="caps">XML</span> wonks apparently
managed to trick everyone into violating Postel&#8217;s law and failing hard when the
browser doesn&#8217;t like something about the <span class="caps">XML</span> it sees. So the moment anything is
slightly out of whack, no one can see your blog. Maybe that&#8217;s why no one in the
world uses MathML except for me?</p>
<p>That brings to mind an old Mark Pilgrim post about <a href="http://diveintomark.org/archives/2004/01/08/postels-law"><span class="caps">XML</span> and Postel&#8217;s
Law</a> which is a good
read, and includes this memorable quote:</p>
<blockquote>
<p>Various people have tried to mandate this principle out of existence, some
going so far as to claim that Postel’s Law should not apply to <span class="caps">XML</span>, because
(apparently) the three letters &#8220;X&#8221;, &#8220;M&#8221;, and &#8220;L&#8221; are a magical combination that
signal a glorious revolution that somehow overturns the fundamental principles
of interoperability.</p>
</blockquote>
<p>Good stuff. Too bad that was <em>five fucking years ago</em> and I&#8217;m still dealing
with this shit.</p>
  <div class="comment-link">
    
    <a  href="/old-comments#comments">No comments</a>.
  </div>

  <h2><a  href="/whisper-0.1">Whisper 0.1 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="12 months ago">March  7, 2009  4:35pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p class='first'>I&#8217;ve released <a href="http://masanjin.net/whisper">Whisper</a> 0.1. Now you can blog like
me. It will happily serve static files, though if you&#8217;re expecting heavy
traffic, you might put it behind something like Nginx. (See instructions in the
configuration file for more.)</p>
<p>How to do it:</p>
<ol>
	<li><code>sudo gem install whisper --source <a href='http://masanjin.net/'>http://masanjin.net/</a></code></li>
	<li><code>whisper-init &lt;blog directory&gt;</code></li>
	<li>Follow the instructions!</li>
</ol>
  <div class="comment-link">
    
    <a  href="/whisper-0.1#comments">No comments</a>.
  </div>

  <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="/welcome-to-whisper">Another month, another blog platform</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="12 months ago">March  1, 2009  8:07am</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> </div>
  
  <p class='first'>Over the past month or so I&#8217;ve been spending some time hacking together yet
another blogging platform, to satisfy all my (admittedly weird) blogging
desires. It&#8217;s finally at the point where I can host my fascinating insights on
it, so here you go. It&#8217;s called Whisper, and you&#8217;re looking at it now.</p>
<p>Interesting features:</p>
<ol>
	<li>No <span class="caps">RDBMS</span>. Storing your blog entries in a <span class="caps">RDBMS</span> is like driving to work in the
Space Shuttle.</li>
	<li>YAML+Textile, sitting on a disk. Like <a href="http://hobix.com">Hobix</a>, blog posts
and comments are stored on disk in regular files, using a mix of <span class="caps">YAML</span> and
Textile. This means you can keep your content under version control, and you
can edit it with whatever editor you desire. Unlike Hobix, the entry content is
stored in a separate file from the metadata, so there&#8217;s none of the trickiness
of embedding Textile in <span class="caps">YAML</span>.</li>
	<li>Sits directly on top of Rack (or Thin). No intermediate layer to slow
things down. These particular bits are served from Thin over a unix socket to
Nginx.</li>
	<li>Lazy cached dependency graph: every bit of content is cached, built lazily,
and a part of a big dependency graph. That means almost every request is
served directly from memory, and making a change, like adding or updating an
entry, forces a regeneration of only those bits that require it.
Infrequently-requested bits of content eventually expire.</li>
	<li>Markup enhancements: I&#8217;ve added some extra processing on top of Textile to do
the things I&#8217;ve always wanted to do. Ruby code is automatically
syntax-highlighted, LaTeX math expressions are turned into MathML (via
<a href="http://ritex.rubyforge.org">RiTeX</a> ), etc. Finally I can write purty-lookin&#8217;
math and code without a ridiculous amount of effort.</li>
	<li>Threaded comments. Why would you not have this?</li>
	<li>Comments via email. This is still a work in progress, but comments can
currently only be made by entering your email address, and replying to the
resulting email. This allows you to quote, thread, and generally have a
reasonable discussion, which is what email is good at, and what typing shit
into little text areas on your web browser is not. The eventual goal
is to automatically mirror the entire conversation, but right now it just
mirrors individual replies.</li>
	<li>Multiformat support. In addition to <span class="caps">HTML</span> and <span class="caps">RSS</span> output, there&#8217;s a <a href="http://all-thing.net/index.txt">plain
text mode for the hard-core</a>.</li>
	<li>Pagination, labels, per-label and per-author indices, etc.</li>
	<li>The whole thing amounts to a little over 1200 lines of code.</li>
</ol>
<p>The code&#8217;s still a while away from being ready for public consumption, but I&#8217;ve
put up a git repo here: <code>git://masanjin.net/whisper</code>.</p>
<p>The next steps are to flesh out the code enough to make it usable by other 
people, make a gem, and maybe publish some performance numbers.</p>
  <div class="comment-link">
    
    <a  href="/welcome-to-whisper#comments">Six comments by <b>William Morgan</b> and <b>Kevin Lingerfelt</b></a>.
  </div>

  <h2><a  href="/indirect-threading">Indirect threading for VM opcode dispatch</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="14 months ago">January  3, 2009 10:50am</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/vm/">vm</a></span> <span class='label'><a  href="/label/optimization/">optimization</a></span> <span class='label'><a  href="/label/whisper/">whisper</a></span> </div>
  
  <p class='first'>There&#8217;s a good discussion with lots of interesting details on a recent <a href="http://bugs.python.org/issue4753">patch
submission for adding indirect threading to the Python
VM</a>. (And by &#8220;discussion&#8221; I mean a single,
un-threaded sequence of comments where you have to manually figure out who&#8217;s
replying to what, which apparently is what everyone in the world is happy with
nowadays except for me. Email clients have had threading since 1975, bitches,
so get with the fucking program. <em>[Hence, Whisper&#8212;ed.]</em>) Pointed to by
<a href="http://programming.reddit.com/">programming.reddit.com</a>, which remains
surprisingly useful, as long as you cut yourself once the comment thread
devolves (as it invariably does) into meta-argumentation.</p>
<p>Indirect threading is a vaguely-neat trick that I first learned about around
the time I was getting into the Rubinius code. The idea is that, in the inner
loop of your VM, which is going through and interpreting the opcodes one at a
time (dispatching each to a block of handler code), instead of jumping back to
the top of the loop at the end of handler code section, you jump directly to
the location of the handler code for the next opcode. The big benefit is not so
much that you save a jump per opcode (which maybe is optimized out for you
anyways), but that the <span class="caps">CPU</span> can do branch prediction on a per-opcode basis. So
common opcode sequences will all be pipelined together.</p>
<p>But the discussion shows that this kind of thing is very compiler- and
architecture-dependent, and you have to spend a lot of time making sure that
<span class="caps">GCC</span> is optimizing the &#8220;right way&#8221; for your particular architecture, is not
overly-optimizing by collapsing the jumps together, etc. <span class="caps">OTOH</span>, the submitter is
reporting a 20% speedup, and this is the very heart of the VM, so it could very
well be worth spending time on such trickery.</p>
<p>More information:</p>
<ul>
	<li><a href="http://www.jilp.org/vol5/v5paper12.pdf">The structure and performance of efficient interpreters</a> [pdf]</li>
	<li><a href="http://blog.mozilla.com/dmandelin/2008/08/27/inline-threading-tracemonkey-etc/">Inline threading, Tracemonkey, etc.</a></li>
	<li>A <a href="http://codespeak.net/pipermail/pypy-dev/2008q4/004916.html">Pypy-dev thread on threaded interpretation</a>.</li>
	<li>Various performance-specific bits of the <a href="http://code.google.com/apis/v8/design.html">V8 Javascript interpreter design</a>.</li>
</ul>
  <div class="comment-link">
    
    <a  href="/indirect-threading#comments">No comments</a>.
  </div>



  <div class="pageblock">
  
  
    <span class="currentpagelink">1</span>
  
    <a class="pagelink" href="/label/whisper/1">2</a>
  
  &nbsp;<a class="pageword" href="/label/whisper/1">Next</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>
