<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daniel’s Blog &#187; Work</title>
	<atom:link href="http://danielkitta.org/blog/category/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://danielkitta.org/blog</link>
	<description>Delusional ramblings of a narcistic individual.</description>
	<lastBuildDate>Thu, 18 Mar 2010 12:09:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bjarne Stroupstrup on C++0x</title>
		<link>http://danielkitta.org/blog/2010/03/18/bjarne-stroupstrup-on-c0x/</link>
		<comments>http://danielkitta.org/blog/2010/03/18/bjarne-stroupstrup-on-c0x/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 12:09:54 +0000</pubDate>
		<dc:creator>Daniel Elstner</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://danielkitta.org/blog/?p=211</guid>
		<description><![CDATA[I&#8217;m just back from Aalto University School of Science and Technology in Espoo, Finland, where I attended Bjarne Stroustrup&#8217;s roadshow talk on C++0x. In the talk, Stroustrup provided a very nice overview of the features in the C++ standard and how they fit into the evolution of the C++ programming language.
Bjarne Stroustrup made the impression [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m just back from <a href="http://www.tkk.fi/en/">Aalto University School of Science and Technology</a> in Espoo, Finland, where I attended <a href="http://www2.research.att.com/~bs/homepage.html">Bjarne Stroustrup</a>&#8217;s roadshow talk on C++0x. In the talk, Stroustrup provided a very nice overview of the features in the C++ standard and how they fit into the evolution of the C++ programming language.</p>
<p>Bjarne Stroustrup made the impression of a down-to-earth guy with a very healthy attitude about C++ features and their development. I was excited to learn that the C++0x draft standard had just been declared final the week before. That means the content of the standard is de-facto finished now, and it will be formalized as an ISO standard in about one year. There sure are quite a number of nice goodies in C++0x, I can&#8217;t wait to get my hands dirty on code using it.</p>
<p>For the C++ groupies among us, I took <a href="http://www.flickr.com/photos/45158207@N08/sets/72157623644005870/">photographs</a> of all presentation slides and of course also of Bjarne Stroustrup himself.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielkitta.org/blog/2010/03/18/bjarne-stroupstrup-on-c0x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why I hate Qt</title>
		<link>http://danielkitta.org/blog/2010/02/25/why-i-hate-qt/</link>
		<comments>http://danielkitta.org/blog/2010/02/25/why-i-hate-qt/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 17:21:27 +0000</pubDate>
		<dc:creator>Daniel Elstner</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://danielkitta.org/blog/?p=203</guid>
		<description><![CDATA[Although I&#8217;m a GNOME and gtkmm guy, my paid work involves Qt. It&#8217;s no secret that I have a very strong antipathy towards the Qt mania to assimilate everything into their framework, the culture of their community, and their nonchalant abuse of the C++ programming language. Often, people suggest that I&#8217;m exaggerating the faults of [...]]]></description>
			<content:encoded><![CDATA[<p>Although I&#8217;m a GNOME and gtkmm guy, my paid work involves Qt. It&#8217;s no secret that I have a very strong antipathy towards the Qt mania to assimilate everything into their framework, the culture of their community, and their nonchalant abuse of the C++ programming language. Often, people suggest that I&#8217;m exaggerating the faults of Qt, and that there are much worse alternatives out there. Fair enough.</p>
<p>But today I happened onto another one of those little inanities which so often add up to a huge stinking pile. I decided to share this particular example, as I think it may help people to understand why I&#8217;m feeling so strongly about Qt.</p>
<p>A while ago, I filed <a href="http://bugreports.qt.nokia.com/browse/QTBUG-5732">Qt bug #5732</a>, together with a patch to fix the problem. In addition to the fix for the central problem reported in the bug, I also provided a second patch to correct another problem I stumbled upon while I worked on the actual bug fix. The bug was acknowledged by a Qt developer and the code got fixed. They decided to fix it their own way instead of applying my patch, which is fair enough. I may not have agreed with the way it was implemented, but the problem I reported was fixed.</p>
<p>Today, I again looked at the Qt OpenGL code, and happened to stumble upon the OpenGL extension checks. Apparently, the extension checking had now finally <a href="http://qt.gitorious.org/qt/qt/commit/bf9456c5a2d8dfe9a35a2175186630cb426858ad">been factored out</a> into a separate class, with a more efficient implementation to avoid the numerous temporary memory allocations of the string splitting method that was used before. Of course I was curious and had a look at the code which implements the string parsing.</p>
<p>Here is how it looks like:</p>
<div class="box-code">
<div><code><span style="color: #666666;">// This class can be used to match GL extensions without doing any mallocs. The</span></code></div>
<div><code><span style="color: #666666;">// class assumes that the GL extension string ends with a space character,</span></code></div>
<div><code><span style="color: #666666;">// which it should do on all conformant platforms. Create the object and pass</span></code></div>
<div><code><span style="color: #666666;">// in a pointer to the extension string, then call match() on each extension</span></code></div>
<div><code><span style="color: #666666;">// that should be matched. The match() function takes the extension name</span></code></div>
<div><code><span style="color: #666666;">// *without* the terminating space character as input.</span></code></div>
<div><code>&nbsp;</code></div>
<div><code><span style="color: #0000ff;">class</span> QGLExtensionMatcher</code></div>
<div><code><span style="color: #008000;">&#123;</span></code></div>
<div><code><span style="color: #0000ff;">public</span><span style="color: #008080;">:</span></code></div>
<div><code>&nbsp; &nbsp; QGLExtensionMatcher<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>str<span style="color: #008000;">&#41;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">:</span> gl_extensions<span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#41;</span>, gl_extensions_length<span style="color: #008000;">&#40;</span>qstrlen<span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; &nbsp; <span style="color: #0000ff;">bool</span> match<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>str<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">int</span> str_length <span style="color: #000080;">=</span> qstrlen<span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>extensions <span style="color: #000080;">=</span> gl_extensions<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">int</span> extensions_length <span style="color: #000080;">=</span> gl_extensions_length<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// the total length that needs to be matched is the str_length +</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// the space character that terminates the extension name</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>extensions_length <span style="color: #000080;">&lt;</span> str_length <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>qstrncmp<span style="color: #008000;">&#40;</span>extensions, str, str_length<span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #000040;">&amp;&amp;</span> extensions<span style="color: #008000;">&#91;</span>str_length<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">' '</span><span style="color: #008000;">&#41;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">int</span> split_pos <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>split_pos <span style="color: #000080;">&lt;</span> extensions_length <span style="color: #000040;">&amp;&amp;</span> extensions<span style="color: #008000;">&#91;</span>split_pos<span style="color: #008000;">&#93;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #FF0000;">' '</span><span style="color: #008000;">&#41;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000040;">++</span>split_pos<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000040;">++</span>split_pos<span style="color: #008080;">;</span> <span style="color: #666666;">// added for the terminating space character</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extensions <span style="color: #000040;">+</span><span style="color: #000080;">=</span> split_pos<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extensions_length <span style="color: #000040;">-</span><span style="color: #000080;">=</span> split_pos<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #008000;">&#125;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code><span style="color: #0000ff;">private</span><span style="color: #008080;">:</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>gl_extensions<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #0000ff;">int</span> gl_extensions_length<span style="color: #008080;">;</span></code></div>
<div><code><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></code></div>
</div>
<p>According to the log message the piece of code just shown went through internal code review. For comparison, here is the equivalent piece of code from my original patch, which was not considered good enough to be applied:</p>
<div class="box-code">
<div><code><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">bool</span> parse_extensions_string<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> extensions, <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> name<span style="color: #008000;">&#41;</span></code></div>
<div><code><span style="color: #008000;">&#123;</span></code></div>
<div><code>&nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">size_t</span> name_length <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>name<span style="color: #008000;">&#41;</span> <span style="color: #008080;">?</span> <span style="color: #0000dd;">strlen</span><span style="color: #008000;">&#40;</span>name<span style="color: #008000;">&#41;</span> <span style="color: #008080;">:</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; Q_ASSERT<span style="color: #008000;">&#40;</span>name_length <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>extensions<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> pos <span style="color: #000080;">=</span> extensions<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; &nbsp; <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span><span style="color: #0000ff;">const</span> space <span style="color: #000080;">=</span> <span style="color: #0000dd;">strchr</span><span style="color: #008000;">&#40;</span>pos, <span style="color: #FF0000;">' '</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">size_t</span> length <span style="color: #000080;">=</span> space <span style="color: #000040;">-</span> pos<span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>length <span style="color: #000080;">==</span> name_length <span style="color: #000040;">&amp;&amp;</span> <span style="color: #0000dd;">memcmp</span><span style="color: #008000;">&#40;</span>pos, name, length<span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span></code></div>
<div><code>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp;</code></div>
<div><code>&nbsp; &nbsp; &nbsp; pos <span style="color: #000080;">=</span> space <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #008000;">&#125;</span></code></div>
<div><code>&nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span>pos, name<span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></code></div>
<div><code>&nbsp; <span style="color: #008000;">&#125;</span></code></div>
<div><code>&nbsp; <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span></code></div>
<div><code><span style="color: #008000;">&#125;</span></code></div>
</div>
<p>So, instead of just taking the code handed to them on a silver platter, the Qt developers decided to roll their own version. Which I wouldn&#8217;t even consider a problem if it weren&#8217;t for the fact that the code that went in is longer, less readable, and generally ugly. It&#8217;s also broken, because there is not a single word in the OpenGL specification about <code>glGetString()</code> always returning a list terminated by a space character, contrary to what the code comment claims about &#8220;all conformant platforms&#8221;.</p>
<p><img src="http://danielkitta.org/blog/wp-content/uploads/2010/02/wtf-is-this-shit.jpg" alt="What the fuck is this shit?" title="What the fuck is this shit?" width="306" height="227" /></p>
]]></content:encoded>
			<wfw:commentRss>http://danielkitta.org/blog/2010/02/25/why-i-hate-qt/feed/</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>Using config.site to set default options</title>
		<link>http://danielkitta.org/blog/2009/09/21/using-config-site-to-set-default-options/</link>
		<comments>http://danielkitta.org/blog/2009/09/21/using-config-site-to-set-default-options/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:20:22 +0000</pubDate>
		<dc:creator>Daniel Elstner</dc:creator>
				<category><![CDATA[Openismus]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://danielkitta.org/blog/?p=182</guid>
		<description><![CDATA[Just a quick note about a little-used feature of GNU Autoconf: site defaults.
Until recently, I used to have a long list of assignments to module_autogenargs['...'] in my ~/.jhbuildrc file to set up default configure options for various modules. This became unwieldy and there was always one module I forgot.
Autoconf comes to the rescue with its [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note about a little-used feature of <abbr title="GNU’s Not Unix">GNU</abbr> <a href="http://www.gnu.org/software/autoconf/">Autoconf</a>: site defaults.</p>
<p>Until recently, I used to have a long list of assignments to <code>module_autogenargs['...']</code> in my <code>~/.jhbuildrc</code> file to set up default <code>configure</code> options for various modules. This became unwieldy and there was always one module I forgot.</p>
<p>Autoconf comes to the rescue with its support for <a href="http://www.gnu.org/software/autoconf/manual/html_node/Site-Defaults.html">site defaults</a>. For illustration, here is my <code>${prefix}/etc/config.site</code> file:</p>
<div class="box-code">
<div><code># Autoconf site defaults</code></div>
<div><code>test -n "$enable_silent_rules" || enable_silent_rules=yes</code></div>
<div><code>test -n "$enable_static" || enable_static=no</code></div>
<div><code>test -n "$enable_warnings" || enable_warnings=fatal</code></div>
</div>
<p>The effect is as if I had passed <code>--enable-silent-rules --disable-static --enable-warnings=fatal</code> to every module&#8217;s <code>./autogen.sh</code>, except that I don&#8217;t get any annoying warnings if a module doesn&#8217;t actually support a particular option. The <code>test</code> conditionals ensure that command-line arguments have precedence over the default values in the <code>config.site</code> file.</p>
<p>Read the manual for the gory details, if you want to. Otherwise, enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://danielkitta.org/blog/2009/09/21/using-config-site-to-set-default-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++ bindings now in GNOME Documentation Library</title>
		<link>http://danielkitta.org/blog/2009/09/17/c-bindings-now-in-gnome-documentation-library/</link>
		<comments>http://danielkitta.org/blog/2009/09/17/c-bindings-now-in-gnome-documentation-library/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 10:17:34 +0000</pubDate>
		<dc:creator>Daniel Elstner</dc:creator>
				<category><![CDATA[Openismus]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://danielkitta.org/blog/?p=174</guid>
		<description><![CDATA[After more than a month of infrastructure work, most of the GNOME C++ binding documentation has now been migrated to the GNOME Documentation Library. This includes the Programming with gtkmm guide and the Doxygen API reference documentation of the core C++ binding modules. Compared to the old documentation hosted on the gtkmm website, we&#8217;ve now [...]]]></description>
			<content:encoded><![CDATA[<p>After more than a month of infrastructure work, most of the <a href="http://www.gnome.org/">GNOME</a> C++ binding documentation has now been migrated to the <a href="http://library.gnome.org/devel/">GNOME Documentation Library</a>. This includes the <a href="http://library.gnome.org/devel/gtkmm-tutorial/">Programming with gtkmm</a> guide and the <a href="http://www.doxygen.org/">Doxygen</a> <abbr title="Application Programming Interface">API</abbr> <a href="http://library.gnome.org/devel/references#c++-bindings">reference documentation</a> of the core C++ binding modules. Compared to the old documentation hosted on the <a href="http://www.gtkmm.org/">gtkmm website</a>, we&#8217;ve now got a bigger pipe, more bling, and less work for us!</p>
<p>All this would not have been possible without the help of <a href="http://www.0d.be/">Frédéric Péters</a>, who did the actual integration work in the <a href="http://git.gnome.org/browse/library-web/">library-web</a> module and has been very responsive to our numerous questions and tweak requests.</p>
<p>Leading up to the migration, the build infrastructure of the GNOME C++ bindings was completely restructured. All the copy&#8217;n'paste of build files had degenerated into an unmaintainable mess. When it became clear that we lacked the infrastructure to properly support cross-references from one documentation module to another, I began to cook up something new to replace the mess. The result of this work is the new <a href="http://git.gnome.org/browse/mm-common/">mm-common</a> module, which provides the shared build support files for the C++ binding modules. As a novelty, it even comes with <a href="http://git.gnome.org/browse/mm-common/tree/README">documentation</a>!</p>
<p>It is quite a bit of work to convert an existing module to use mm-common, and the transition took more time than I had expected. Despite that, the feedback was very positive, and a number of module maintainers started to convert their modules to mm-common on their own. Many thanks to David King, Fabien Parent, Jonathon Jongsma, José Alburquerque, Krzesimir Nowak and Murray Cumming for your work and feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://danielkitta.org/blog/2009/09/17/c-bindings-now-in-gnome-documentation-library/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Non-Recursive Automake Performance</title>
		<link>http://danielkitta.org/blog/2009/07/30/non-recursive-automake-performance/</link>
		<comments>http://danielkitta.org/blog/2009/07/30/non-recursive-automake-performance/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 16:46:55 +0000</pubDate>
		<dc:creator>Daniel Elstner</dc:creator>
				<category><![CDATA[Openismus]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[autotools]]></category>

		<guid isPermaLink="false">http://danielkitta.org/blog/?p=81</guid>
		<description><![CDATA[A few days ago, Murray blogged about Glom&#8217;s switch to non-recursive Automake. The topic attracted more feedback than I had expected, and I have been asked if I could give a more detailed account of the speed improvements mentioned by Murray.
For the background, I highly recommend to read the original paper by Peter Miller, Recursive [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, Murray blogged about <a href="http://www.murrayc.com/blog/permalink/2009/07/24/non-recursive-automake-is-the-best-alternative-to-automake/">Glom&#8217;s switch to non-recursive Automake</a>. The topic attracted more feedback than I had expected, and I have been asked if I could give a more detailed account of the speed improvements mentioned by Murray.</p>
<p>For the background, I highly recommend to read the original paper by Peter Miller, <a href="http://miller.emu.id.au/pmiller/books/rmch/">Recursive Make Considered Harmful</a>. Here&#8217;s an appetizer:</p>
<blockquote><p>For large UNIX projects, the traditional method of building the project is to use recursive make. On some projects, this results in build times which are unacceptably large, when all you want to do is change one file. In examining the source of the overly long build times, it became evident that a number of apparently unrelated problems combine to produce the delay, but on analysis all have the same root cause.</p></blockquote>
<p>First off, here are the results for the Glom build, measured before and after the switchover:</p>
<div style="border: 0.09em solid #DDDDDD; margin: 1.5em; padding: 1.5em 2em; min-width: 20em; max-width: 40em;">
<div><code>make -j2</code> (clean tree)</div>
<div style="margin: 0.8em 0; padding: 0; width: 100%; background-color: #ADA7C8; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">337.0 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">recursive make</div>
</div>
<div style="margin: 1em 0; padding: 0; width: 81.41%; background-color: #83A67F; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">274.4 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">non-recursive make</div>
</div>
<div><code>make -j2</code> (nothing to be done)</div>
<div style="margin: 0.8em 0; padding: 0; width: 100%; background-color: #ADA7C8; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">4.7 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">recursive make</div>
</div>
<div style="margin: 1em 0; padding: 0; width: 74.47%; background-color: #83A67F; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">3.5 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">non-recursive make</div>
</div>
<div><code>make install</code></div>
<div style="margin: 0.8em 0; padding: 0; width: 100%; background-color: #ADA7C8; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">9.6 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">recursive make</div>
</div>
<div style="margin: 1em 0; padding: 0; width: 72.56%; background-color: #83A67F; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">7.0 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">non-recursive make</div>
</div>
<div><code>make clean</code></div>
<div style="margin: 0.8em 0; padding: 0; width: 100%; background-color: #ADA7C8; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">3.3 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">recursive make</div>
</div>
<div style="margin: 1em 0; padding: 0; width: 87.6%; background-color: #83A67F; color: #000000">
<div style="margin: 0; padding: 0.25em 1em; float: right;">2.9 seconds</div>
<div style="margin: 0; padding: 0.25em 1em; font-style: oblique;">non-recursive make</div>
</div>
</div>
<p>These results were obtained on a Lenovo desktop PC with an Intel Core&#8239;2 Duo E7200 at 2.53&#8239;GHz and 3&#8239;GiB RAM. The operating system is Ubuntu 9.04 (jaunty) for AMD64, installed on an ext4 volume of an encrypted <abbr title="Logical Volume Manager">LVM</abbr> partition. At the time of the measurements, the full GNOME desktop interface was up and running, but otherwise idle. The entire measurement was repeated once with nearly identical results, and the timings presented here are the averages of the two runs.</p>
<p>As can be seen, the switch to non-recursive make reduced the time of a full Glom build by about 19&#8239;% on this machine, or more than one minute, which I think is quite decent. However, before you start to convert your own module, be aware that the performance gain you&#8217;ll see depends heavily on the specifics of your project. It&#8217;s practically guaranteed that you&#8217;ll see <em>some</em> improvement, but it could be a meager 0.1&#8239;% speedup. However, 40&#8239;% are just as possible. To help people gauge the possible effect on their project, I&#8217;ll try to outline the factors which I found to matter most in my experience.</p>
<p>Essentially, performance is improved because of two things: First, the time for make to get going and resolve dependencies includes a constant part, which introduces a significant delay even if there is nothing to rebuild. The second problem is that even with parallel make, subdirectories are normally entered in sequence, in order to prevent the number of parallel processes from increasing exponentially. A subdirectory cannot be left until all its targets have finished building. Unless the execution times of all parallel build processes overlap perfectly, one or more processor cores will idle. This effect will be more pronounced if the average number of source files per subdirectory is small. In the pathological case of one file per directory, there will be no parallelism at all. A classic example is the directory hierarchy of source code examples found in many library modules.</p>
<p>The programming language used also plays a role. On average, the idle periods due to imperfect overlap of parallel compilation processes will be longer if compilation is slow. Typically, a C++ source file will require substantially more time to compile than a C source file. The same holds for large source files versus small source files. The optimization level and other compiler settings also influence the compile time per object. With non-recursive make, the stalls due to imperfect overlap will only occur for targets which depend on multiple intermediate targets, such as when linking object files into a library. Even when make needs to wait for a dependency before it can continue with a target, it will still continue building any independent targets. Thus, the builds of multiple independent executables or libraries overlap, thereby hiding the stalls.</p>
<p>With all that mind, I think the 19&#8239;% speedup in the case of Glom should be considered above average. The directory hierarchy is deeply nested, with a small number of source files per subdirectory, although not as small as to be pathological. One important factor is that Glom used to build an intermediate static library in each subdirectory, which were later linked to produce the actual target binary. The new non-recursive build system omits these intermediate libraries and simply links all object files from all subdirectories in one go to produce the final target binary.</p>
<p>Automake has included support for non-recursive make for quite a while now, and it turns out to be surprisingly straightforward and easy to use. All you need to get going is <code>AM_PROG_CC_C_O</code> in your <code>configure.ac</code> for C compiler support, and <code>AUTOMAKE_OPTIONS = subdir-objects</code> in your <code>Makefile.am</code>. To refer to files in a subdirectory, just include the relative directory prefix. Automake variable names also include the directory prefix of the file names they are derived from. The <code>*.am</code> files in the <a href="http://git.gnome.org/cgit/glom/tree/">Glom repository</a> may be helpful as real-world examples.</p>
<p>Happy <code>make -j∞</code>&#8239;!</p>
]]></content:encoded>
			<wfw:commentRss>http://danielkitta.org/blog/2009/07/30/non-recursive-automake-performance/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
