<?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>emphess .NET &#187; Performance</title>
	<atom:link href="http://www.emphess.net/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emphess.net</link>
	<description>Christoph Menge&#039;s Blog</description>
	<lastBuildDate>Tue, 15 Jun 2010 00:50:30 +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>db4o Queries on Large Datasets and a bit of Linq</title>
		<link>http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/</link>
		<comments>http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 12:26:49 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[db4o]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=123</guid>
		<description><![CDATA[My last small note on db4o performance will soon be outdated &#8211; fortunately. Newer releases of db4o will no longer rely on Cecil to perform reflection, thereby speeding up db4o linq queries &#8211; However, make sure you have Mono.Reflection.dll in your app! Also there are some restrictions when it comes to the compact framework and [...]]]></description>
			<content:encoded><![CDATA[<p>My last small note on db4o performance <a href="http://developer.db4o.com/Forums/tabid/98/aff/37/aft/9716/afv/topic/Default.aspx">will soon be outdated</a> &#8211; fortunately. Newer releases of db4o will no longer rely on Cecil to perform reflection, thereby speeding up db4o linq queries &#8211; <strong>However, make sure you have Mono.Reflection.dll in your app!</strong> Also there are some restrictions when it comes to the compact framework and native queries (which still need Cecil), so you&#8217;d best make sure to <a href="http://developer.db4o.com/Blogs/Product/tabid/167/archive/month/date/2010-02-28/Default.aspx" target="_blank">read this official db4o announcement</a>.</p>
<p>Talking about speed and performance, I just came across an issue that was also discussed in db4o forums very recently: Sort operations on large datasets.<br />
Note: This has nothing to do with linq or linq to db4o, it&#8217;s just the same for SODA queries.</p>
<p>Let&#8217;s take a very common example: Find some most recent items, for example most recent blog/forum posts or some other &#8216;top list&#8217; on a very large amount of entries N:</p>
<pre class="brush: csharp">
        var mostRecentPosts = (from Posts o
              in ObjectContainer
              orderby o.Created descending
              select o).Take(100).ToList();
</pre>
<p>This query will be really really slow on a large amount of objects. Why? Essentially, the BTREE operation is very fast as it should be, but unfortunately db4o will invoke its SODA system on each of the objects, even if they are already outruled by the BTREE operation. </p>
<p>See <a href="http://developer.db4o.com/Forums/tabid/98/aff/4/aft/9751/afv/topic/afpgj/1/Default.aspx#27735">this discussion on the db4o forum</a> and <a href="http://tracker.db4o.com/browse/COR-1133">the associated Jira-bug</a>.</p>
<p>This is somewhat sad, because a query on a previously filtered set of items is blazing, about 100x faster:</p>
<pre class="brush: csharp">
        var mostRecentPosts = (from Posts o
              in ObjectContainer
              where o.Created &gt; yesterday
              orderby o.Created descending
              select o).Take(100).ToList();
</pre>
<p>The latter operation plays roughly in the same league as SQL Server (don&#8217;t flame me &#8211; performance comparisons and profiling is really complicated and there is a zillion of factors that influence it, I know. That&#8217;s why I say &#8216;roughly the same league for this query&#8217; and I&#8217;m talking about default setups). </p>
<p>This is a somewhat unfortunate situation, because it produces slow queries for many typical applications &#8211; unless you have a strong where clause that cuts down N from millions to hundreds. If you&#8217;re interested in seeing this issue fixed, head over to their <a href="http://tracker.db4o.com/browse/COR-1133">issue tracker and vote for the issue to be fixed</a>! Thanks!</p>
<p>I&#8217;ll be posting a bit more on db4o over the next few days I hope.</p>
<div style="float: right;"><p align="right"><a rel="nofollow" class="tt" href="http://twitter.com/home/?status=db4o+Queries+on+Large+Datasets+and+a+bit+of+Linq+http://bit.ly/91M9fW" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/&amp;title=db4o+Queries+on+Large+Datasets+and+a+bit+of+Linq" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/&amp;title=db4o+Queries+on+Large+Datasets+and+a+bit+of+Linq" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/&amp;t=db4o+Queries+on+Large+Datasets+and+a+bit+of+Linq" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>db4o Performance Pitfalls</title>
		<link>http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/</link>
		<comments>http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 01:04:18 +0000</pubDate>
		<dc:creator>Christoph Menge</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[db4o]]></category>
		<category><![CDATA[Native Query]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[OODBMS]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.emphess.net/?p=96</guid>
		<description><![CDATA[This is just a quick note, but I just gotta share this right now.
It&#8217;s actually in the manual so this is not exactly a secret, but I managed to overlook it so perhaps I&#8217;m not the only one&#8230; 
In our specific scenario, db4o was about 3 times slower than MSSQL via Linq to SQL in [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick note, but I just gotta share this <em>right now</em>.</p>
<p>It&#8217;s actually in the manual so this is not exactly a secret, but I managed to overlook it so perhaps I&#8217;m not the only one&#8230; </p>
<p>In our specific scenario, db4o was about 3 times slower than MSSQL via Linq to SQL in the past days.</p>
<p>Just a few minutes ago, I finally read this:</p>
<blockquote><p>Native Query optimizer for .NET requires the following libraries to work:<br />
Db4obects.Db4o.Instrumentation.dll<br />
Db4objects.Db4o.NativeQueries.dll<br />
Mono.Cecil.dll<br />
Cecil.FlowAnalysis.dll</p></blockquote>
<p>(see <a href="http://developer.db4o.com/Documentation/Reference/db4o-7.12/net35/reference/html/reference/tuning/native_query_optimization.html">http://developer.db4o.com/Documentation/Reference/db4o-7.12/net35/reference/html/reference/tuning/native_query_optimization.html</a>)</p>
<p>I added these dll&#8217;s to my solution and wooosh! Now it&#8217;s up to 50 times faster than before! That&#8217;s what I needed&#8230; Will see how this works with larger data sets&#8230;</p>
<p><strong>Update</strong>: There have been some important changes in builds past 14021, see my <a href="http://www.emphess.net/2010/03/16/db4o-queries-on-large-datasets-and-a-bit-of-linq">more recent post</a> on that topic. In short, the new kid in town is <code>Mono.Reflection.dll</code>, which took Cecil&#8217;s place. </p>
<div style="float: right;"><p align="right"><a rel="nofollow" class="tt" href="http://twitter.com/home/?status=db4o+Performance+Pitfalls+http://bit.ly/covUKN" title="Post to Twitter"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-twitter2.png" alt="Post to Twitter" /></a> <a rel="nofollow" class="tt" href="http://delicious.com/post?url=http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/&amp;title=db4o+Performance+Pitfalls" title="Post to Delicious"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a rel="nofollow" class="tt" href="http://digg.com/submit?url=http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/&amp;title=db4o+Performance+Pitfalls" title="Post to Digg"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/&amp;t=db4o+Performance+Pitfalls" title="Post to Facebook"><img class="nothumb" src="http://www.emphess.net/wp-content/plugins/tweet-this/icons/tt-facebook.png" alt="Post to Facebook" /></a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.emphess.net/2010/02/11/db4o-performance-pitfalls/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
