<?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>Indigo &#187; Core Data</title>
	<atom:link href="http://i.ndigo.com.br/tag/core-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://i.ndigo.com.br</link>
	<description>I.ndigo Website</description>
	<lastBuildDate>Fri, 03 Feb 2012 19:01:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Core Data over SQLite Performance Tests &#8211; Part 3</title>
		<link>http://i.ndigo.com.br/2010/08/core-data-over-sqlite-performance-tests-part-3/</link>
		<comments>http://i.ndigo.com.br/2010/08/core-data-over-sqlite-performance-tests-part-3/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 15:26:40 +0000</pubDate>
		<dc:creator>Raphael Petegrosso</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=228</guid>
		<description><![CDATA[Following the last post, Core Data over SQLite Performance Tests &#8211; Part 2, when we began performance tests with Core Data, now we continue with the results of this analysis. As we defined before, this test will show the performance of 4 situations (see details on the previous post): Insert without join tables; Inserts with [...]]]></description>
			<content:encoded><![CDATA[<p>Following the last post, <a title="Core Data over SQLite Performance Tests - Part 2" href="http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-2">Core Data over SQLite Performance Tests &#8211; Part 2</a>, when we began performance tests with Core Data, now we continue with the results of this analysis.</p>
<p>As we defined before, this test will show the performance of 4 situations (see details on the previous post):</p>
<ol style="margin-left: 25px;">
<li>Insert without join  tables;</li>
<li>Inserts with tables;</li>
<li>Select without join tables;</li>
<li>Select with join tables.</li>
</ol>
<p>The previous post showed the first 2 situations. This time we will cover the last 2 (selects).</p>
<h3><strong>1. Select without join tables</strong></h3>
<p>This test tries to execute selects without joins in 2 ways:</p>
<ul>
<li>Fetch by object&#8217;s attributes;</li>
<li>Fetch by identifier.</li>
</ul>
<p>In each case, we see how the time to execute the select varies with the number of registries of the table (from 1 to 10000):</p>
<p><strong>a) Fetch by object&#8217;s attributes</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image8.png" alt="" title="" width="618" class="alignnone size-full wp-image-242" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.007469 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.259504 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.049227 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">492.3 s</td>
</tr>
</tbody>
</table>
<p>As we can see on the chart, when fetching by an attribute that is not indexed the time needed to execute the select varies almost linearly with the number of registries of the table. So, it is easy to think on how the performance of your table is getting worst with the time.</p>
<p><strong>b) Fetch by identifier</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image1.png" alt="" title="" width="618" class="alignnone size-full wp-image-237" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.000070 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.004420 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.000086 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">0.8597 s</td>
</tr>
</tbody>
</table>
<p>This case shown us that fetching by the identifier (indexed), the time to fetch almost do not change with the number of registries, once the average time to fetch was almost equal the min time.</p>
<p><strong>Conclusion</strong></p>
<p>This tests resulted on the following table:</p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Test</strong></td>
<td style="width: 120px; text-align: center;"><strong>Average Time per Select</strong></td>
<td style="width: 120px; text-align: center;"><strong>Total Time</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">Fetch by object&#8217;s attributes</td>
<td style="width: 120px; text-align: center;">t1 or 0.049227 s</td>
<td style="width: 120px; text-align: center;">t2 or 492.3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">Fetch by identifier</td>
<td style="width: 120px; text-align: center;">0.0017 x t1 or 0.000086 s</td>
<td style="width: 120px; text-align: center;">0.0017 x t2 or 0.8597 s</td>
</tr>
</tbody>
</table>
<p>As we can see, for simple selects (without joins) when possible we should use identifiers to fetch, but, if we need to fetch by an attribute, it&#8217;s not hard to think about the performance, once it increases linearly with the size of the table.</p>
<h3><strong>2. Selects with join tables</strong></h3>
<p>This test shows how the time to execute a select increases as the number of join tables (in each select) and number of rows increases. The number of joins varies from 0 to 4.</p>
<p><strong>a) Joins quantity: 0</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image3.png" alt="" title="" width="618" class="alignnone size-full wp-image-239" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.010763 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.405039 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.071537 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">7.15 s</td>
</tr>
</tbody>
</table>
<p>This test has no joins, so the results is the same from the previous test when fetching by an attribute.</p>
<p><strong>b) Joins quantity: 1</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image2.png" alt="" title="" width="618" class="alignnone size-full wp-image-238" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.012153 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.632435 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.299673 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">29.98 s</td>
</tr>
</tbody>
</table>
<p>As might be expected, with 1 join the average time to a insert was much worst, about 4.27 times greater than with 0 joins.</p>
<p><strong>c) Joins quantity: 2</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image4.png" alt="" title="" width="618" class="alignnone size-full wp-image-240" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.021038 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.633293 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.29986 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">29.96 s</td>
</tr>
</tbody>
</table>
<p>With 2 joins we needed almost the same time to process the select, as expected, once the fetching engine has already entered on the process&#8217; join step, what is not needed with 0 joins.</p>
<p><strong>d) Joins quantity: 3</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image0.png" alt="" title="" width="618" class="alignnone size-full wp-image-236" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.025723 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.621014 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.303619 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">30.36 s</td>
</tr>
</tbody>
</table>
<p>With 3 joins the average time was slightly worst again, as we might expect.</p>
<p><strong>e) Joins quantity: 4</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image6.png" alt="" title="" width="618" class="alignnone size-full wp-image-241" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.027883 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.64675 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.316077 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">31.61 s</td>
</tr>
</tbody>
</table>
<p>Again, with 4 joins the average time was slightly worst, as we might expect.</p>
<p><strong>Conclusion</strong></p>
<p>The following table results from the tests:</p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Test</strong></td>
<td style="width: 120px; text-align: center;"><strong>Average Time</strong></td>
<td style="width: 120px; text-align: center;"><strong>Total Time</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">0 joins</td>
<td style="width: 120px; text-align: center;">0.071537 s</td>
<td style="width: 120px; text-align: center;">7.15 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">1 join</td>
<td style="width: 120px; text-align: center;">0.299673 s</td>
<td style="width: 120px; text-align: center;">29.98 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">2 joins</td>
<td style="width: 120px; text-align: center;">0.29986 s</td>
<td style="width: 120px; text-align: center;">29.96 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">3 joins</td>
<td style="width: 120px; text-align: center;">0.303619 s</td>
<td style="width: 120px; text-align: center;">30.36 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">4 joins</td>
<td style="width: 120px; text-align: center;">0.316077 s</td>
<td style="width: 120px; text-align: center;">31.61 s</td>
</tr>
</tbody>
</table>
<p>As we can see, we have a great variance from 0 to 1 join, but a small variance as the number of joins increases, due the way the select engine works.</p>
<p>This post, and the previous one, showed performance tests for Core Data that bring us information to analyse when use it in a project and what impact we would have when using it.</p>
<p>The next posts will present our analysis over the <a href="http://bitbucket.org/magicalpanda/activerecord-for-core-data">Magical Panda Active Record</a> framework. We expect you are anxious as we are. Stay tuned!</p>
<p>This post is also available in Portuguese: <a href="http://i.ndigo.com.br/2010/08/testes-de-performance-do-core-data-sobre-sqlite-parte-3">Testes de performance do Core Data sobre SQLite – Parte 3</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/08/core-data-over-sqlite-performance-tests-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testes de performance do Core Data sobre SQLite &#8211; Parte 3</title>
		<link>http://i.ndigo.com.br/2010/08/testes-de-performance-do-core-data-sobre-sqlite-parte-3/</link>
		<comments>http://i.ndigo.com.br/2010/08/testes-de-performance-do-core-data-sobre-sqlite-parte-3/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 15:26:23 +0000</pubDate>
		<dc:creator>Raphael Petegrosso</dc:creator>
				<category><![CDATA[Go Tech]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=233</guid>
		<description><![CDATA[Seguindo nosso último post, Testes de performance do Core Data sobre SQLite &#8211; Parte 2, quando iniciamos testes de desempenho com o Core Cata, agora continuaremos com os resultados desta análise. Como definimos anteriormente este teste mostrará o desempenho em 4 situações (veja detalhes no post anterior): Inserções sem relacionamentos; Inserções com relacionamentos; Buscas sem [...]]]></description>
			<content:encoded><![CDATA[<p>Seguindo nosso último post, <a title="Testes de performance do Core Data sobre SQLite - Parte 1" href="http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-2">Testes de performance do Core Data sobre SQLite &#8211; Parte 2</a>, quando iniciamos testes de desempenho com o Core Cata, agora continuaremos com os resultados desta análise.</p>
<p>Como definimos anteriormente este teste mostrará o desempenho em 4 situações (veja detalhes no post anterior):</p>
<ol style="margin-left: 25px;">
<li>Inserções sem relacionamentos;</li>
<li>Inserções com relacionamentos;</li>
<li>Buscas sem relacionamentos;</li>
<li>Buscas com relacionamentos.</li>
</ol>
<p>O post anterior mostrou as 2 primeiras situações. Este post mostrará as últimas duas (selects).</p>
<h3><strong>1. Buscas sem relacionamentos</strong></h3>
<p>Este teste tenta executar buscas sem joins de 2 formas:</p>
<ul>
<li>Busca por atributo;</li>
<li>Busca por identificador.</li>
</ul>
<p>Em cada caso, vemos como o tempo para executar a busca varia com o número de registros da tabela (de 1 até 10000):</p>
<p><strong>a) Busca por atributo</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image8.png" alt="" title="" width="618" class="alignnone size-full wp-image-242" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,007469 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,259504 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,049227 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">492,3 s</td>
</tr>
</tbody>
</table>
<p>Como podemos ver no gráfico, quando buscando por um atributo que não esteja indexado o tempo necessário para executar o select varia quase linearmente com o número de registros da tabela. Assim, é fácil pensar em como o desempenho de sua tabela está piorando com o tempo.</p>
<p><strong>b) Busca por identificador</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image1.png" alt="" title="" width="618" class="alignnone size-full wp-image-237" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,000070 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,004420 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,000086 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">0,8597 s</td>
</tr>
</tbody>
</table>
<p>Este caso mostra que buscando pelo identificador (indexado), o tempo de busca praticamente não muda com o aumento do número de registros da tabela, uma vez que o tempo médio de busca foi quase igual ao tempo mínimo.</p>
<p><strong>Conclusão</strong></p>
<p>Estes testes resultaram na seguinte tabela:</p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Teste</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo Médio por Select</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo Total</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">Busca por atributo</td>
<td style="width: 120px; text-align: center;">t1 or 0,049227 s</td>
<td style="width: 120px; text-align: center;">t2 or 492,3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">Busca por identificador</td>
<td style="width: 120px; text-align: center;">0,0017 x t1 or 0,000086 s</td>
<td style="width: 120px; text-align: center;">0,0017 x t2 or 0,8597 s</td>
</tr>
</tbody>
</table>
<p>Como podemos ver, para selects simples (sem joins) sempre que possível devemos usar identificadores para a busca, mas, se precisarmos buscar pelo identificador, não é difícil pensar no desempenho, uma vez que ele aumenta linearmente com o tamanho da tabela.</p>
<h3><strong>2. Buscas com relacionamentos</strong></h3>
<p>Este teste mostra como o tempo para executar um select aumenta com o número de joins (em cada select) e o número de linhas. O número de joins varia de 0 a 4.</p>
<p><strong>a) Relacionamentos: 0</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image3.png" alt="" title="" width="618" class="alignnone size-full wp-image-239" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,010763 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,405039 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,071537 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">7,15 s</td>
</tr>
</tbody>
</table>
<p>Este teste não tem relacionamentos, então o resultado é o mesmo do teste anterior quando buscando por um atributo.</p>
<p><strong>b) Relacionamentos: 1</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image2.png" alt="" title="" width="618" class="alignnone size-full wp-image-238" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,012153 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,632435 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,299673 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">29,98 s</td>
</tr>
</tbody>
</table>
<p>Como esperado, com 1 join o tempo médio foi bem maior, 4,27 vezes maior que com 0 joins.</p>
<p><strong>c) Relacionamentos: 2</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image4.png" alt="" title="" width="618" class="alignnone size-full wp-image-240" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,021038 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,633293 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,29986 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">29,96 s</td>
</tr>
</tbody>
</table>
<p>Com 2 joins precisamos de quase o mesmo tempo de processar o select, como esperado, uma vez que a engine de busca já entrou o passo de join do processo de busca, o que não ocorre com 0 joins.</p>
<p><strong>d) Relacionamentos: 3</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image0.png" alt="" title="" width="618" class="alignnone size-full wp-image-236" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,025723 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,621014 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,303619 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">30,36 s</td>
</tr>
</tbody>
</table>
<p>Com 3 joins o tempo médio foi levemente pior novamente, como esperado.</p>
<p><strong>e) Relacionamentos: 4</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/08/image6.png" alt="" title="" width="618" class="alignnone size-full wp-image-241" /></p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,027883 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,64675 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,316077 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">31,61 s</td>
</tr>
</tbody>
</table>
<p>Novamente, com 4 joins o tempo médio foi levemente pior, como esperado.</p>
<p><strong>Conclusão</strong></p>
<p>A seguinte tabela resulta dos testes:</p>
<table style="margin-left: auto; margin-right: auto; margin-top: 50px; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Teste</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo Médio</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo Total</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">0 joins</td>
<td style="width: 120px; text-align: center;">0,071537 s</td>
<td style="width: 120px; text-align: center;">7,15 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">1 join</td>
<td style="width: 120px; text-align: center;">0,299673 s</td>
<td style="width: 120px; text-align: center;">29,98 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">2 joins</td>
<td style="width: 120px; text-align: center;">0,29986 s</td>
<td style="width: 120px; text-align: center;">29,96 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">3 joins</td>
<td style="width: 120px; text-align: center;">0,303619 s</td>
<td style="width: 120px; text-align: center;">30,36 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">4 joins</td>
<td style="width: 120px; text-align: center;">0,316077 s</td>
<td style="width: 120px; text-align: center;">31,61 s</td>
</tr>
</tbody>
</table>
<p>Como podemos ver, temos uma grande variação de 0 para 1 join, mas uma pequena variação conforme o número de joins aumenta, devido a funcionamento da engine de busca.</p>
<p>Este post, e o anterior, mostraram os testes de desempenho para o Core Data, que nos trouxeram informações para analisar quando usá-lo em um project e qual impacto teríamos quando usando-o.</p>
<p>Os próximos posts apresentarão nossa análise sobre o framework <a href="http://bitbucket.org/magicalpanda/activerecord-for-core-data">Magical Panda Active Record</a>. Esperamos que você esteja ansioso como nós estamos. </p>
<p>Este post também está disponível em Inglês: <a href="http://i.ndigo.com.br/2010/08/core-data-over-sqlite-performance-tests-part-3">Core Data over SQLite Performance Tests – Part 3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/08/testes-de-performance-do-core-data-sobre-sqlite-parte-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testes de performance do Core Data sobre SQLite &#8211; Parte 2</title>
		<link>http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-2/</link>
		<comments>http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-2/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 23:00:21 +0000</pubDate>
		<dc:creator>Raphael Petegrosso</dc:creator>
				<category><![CDATA[Go Tech]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=160</guid>
		<description><![CDATA[Dando seqüência ao último post, Testes de performance do Core Data sobre SQLite &#8211; Parte 1, no qual introduzimos o Core Data e definimos o ambiente de testes, agora iniciaremos a apresentação dos resultados desta análise. Assim como definido anteriormente, este teste mostrará o desempenho em 4 situações (veja detalhes no post anterior): Inserções sem [...]]]></description>
			<content:encoded><![CDATA[<p>Dando seqüência ao último post, <a title="Testes de performance do Core Data sobre SQLite - Parte 1" href="http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-1">Testes de performance do Core Data sobre SQLite &#8211; Parte 1</a>, no qual introduzimos o Core Data e definimos o ambiente de testes, agora iniciaremos a apresentação dos resultados desta análise.</p>
<p>Assim como definido anteriormente, este teste mostrará o desempenho em 4 situações (veja detalhes no post anterior):</p>
<ol style="margin-left: 25px;">
<li>Inserções sem relacionamentos;</li>
<li>Inserções com relacionamentos;</li>
<li>Buscas sem relacionamentos;</li>
<li>Buscas com relacionamentos.</li>
</ol>
<p>Este post cobrirá as 2 primeiras situações (inserções).</p>
<h3><strong>1. Inserções sem relacionamentos</strong></h3>
<p>Este teste tenta executar 10000 comandos inserts de 5 formas diferentes:</p>
<ul>
<li>Tamanho do lote: 1; Repetições: 10000;</li>
<li>Tamanho do lote: 10; Repetições: 1000;</li>
<li>Tamanho do lote: 100; Repetições: 100;</li>
<li>Tamanho do lote: 1000; Repetições: 10;</li>
<li>Tamanho do lote: 10000; Repetições: 1;</li>
</ul>
<p>Os resultados foram os seguintes:</p>
<p><strong>a) Tamanho do lote: 1; Repetições: 10000</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.001.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,037017 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,571604 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,047213 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">417,3 s</td>
</tr>
</tbody>
</table>
<p>Como podemos ver no gráfico, temos uma pequena variação entre o tempo das inserções. Embora o valor máximo do gráfico seja 0,57 segundos, a média (0,047 s) foi bem mais próxima do valor mínimo (0,037 s). Também, podemos ver que o tempo necessário para uma inserções não muda significantemente enquanto a tabela aumenta.</p>
<p><strong>b) Tamanho do lote: 10; Repetições: 1000</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.002.png" alt="" title="" width="620" height="179" class="alignnone size-full wp-image-139" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,051545 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">1,592167 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,077328 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">77,3 s</td>
</tr>
</tbody>
</table>
<p>Este caso nos mostrou que, aumentando o tamanho do lote para 10 precisamos, em média, de cerca de 1,64 vezes mais tempo para executar este lote. Assim, podemos imaginar que é muito melhor executar um lote grande do que vários lotes pequenos. O teste também nos mostrou que para inserir 10000 registros com tamanho de lote de 10 precisamos de 77,3 segundos, enquanto com tamanho de lote de 1, para inserir 10000 registros precisamos de 417,3 segundos.</p>
<p><strong>c) Tamanho de lote: 100; Repetições: 100</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.003.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,221817 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,733436 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,276504 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">27,7 s</td>
</tr>
</tbody>
</table>
<p>Novamente, aumentando o tamanho de lote, agora para 100, precisamos de cerca de 3,6 mais tempo por lote do que precisamos com tamanho de lote de 10. Assim, podemos deduzir que o tempo por lote não aumenta linearmente com o tamanho de lote. Mas novamente, o tempo total para executar os 10000 inserts diminuiu (27 s contra 77 s).</p>
<p><strong>d) Tamanho de lote: 1000; Repetições: 10</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.004.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">2,341496 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">2,895445 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">2,522845 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">25,2 s</td>
</tr>
</tbody>
</table>
<p>Novamente, o mesmo aconteceu. Com o aumento do tamanho de lote para 1000 precisamos de 9,1 vezes mais tempo do que com tamanho de lote de 100. O tempo total foi melhor que o anterior, mas quase o mesmo (25 s contra 27).</p>
<p><strong>e) Tamanho de lote: 10000; Repetições: 1 (10 repetições com banco vazio)</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.005.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">19,171194 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">24,020913 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">22,2 s</td>
</tr>
</tbody>
</table>
<p>Desta vez, aumentando o tamanho de lote para 10000 precisamos de 8 vezes mais tempo do que com tamanho de lote de 1000, enquanto poderíamos imaginar que precisaríamos de mais de 9,1 vezes. Assim, levamos somente 22 s para executar os 10000 inserts.</p>
<p><strong>Conclusão</strong></p>
<p>Estes testes resultaram na seguinte tabela:</p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Teste</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo médio por lote</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo Total</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">a</td>
<td style="width: 120px; text-align: center;">t1 ou 0,047213 s</td>
<td style="width: 120px; text-align: center;">t2 ou 417,3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">b</td>
<td style="width: 120px; text-align: center;">1,83 x t1 ou 0,077328 s</td>
<td style="width: 120px; text-align: center;">t2/5,40 ou 77,3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">c</td>
<td style="width: 120px; text-align: center;">5,86 x t1 ou 0,276504 s</td>
<td style="width: 120px; text-align: center;">t2/0,066 ou 27,7 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">d</td>
<td style="width: 120px; text-align: center;">53,68 x t1 ou 2,523 s</td>
<td style="width: 120px; text-align: center;">t2/0.060 ou 25,2 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">e</td>
<td style="width: 120px; text-align: center;">470,34 x t1 ou 22,2 s</td>
<td style="width: 120px; text-align: center;">t2/0,053 ou 22,2 s</td>
</tr>
</tbody>
</table>
<p>Como podemos ver, para inserções simples (sem relacionamentos) quando aumentamos o tamanho do lote o tempo para executá-lo é maior, mas, o tempo total é menor. Assim, quando usando o Core Data, sempre que possível devemos salvar dados em lotes grandes.</p>
<h3><strong>2. Inserções com relacionamentos</strong></h3>
<p>Este teste mostra como o tempo para executar uma inserção aumenta com o aumento do número de relacionamentos (em cada inserção) e de linhas da tabela. O número de relacionamentos varia de 0 até 3.</p>
<p><strong>a) Quantidade de relacionamentos: 0</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.006.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,053622 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,626013 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,068631 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">137,3 s</td>
</tr>
</tbody>
</table>
<p>Como este teste não contém relacionamentos, o resultado é o mesmo do teste anterior.</p>
<p><strong>b) Quantidade de relacionamentos: 1</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.007.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,617910 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,353416 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,080156 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">160,3 s</td>
</tr>
</tbody>
</table>
<p>Como seria esperado, com um relacionamento o tempo médio de inserção foi 1,17 vezes maior do que sem inserções.</p>
<p><strong>c) Quantidade de relacionamentos: 2</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.008.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,078214 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,559592 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,109143 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">218,3 s</td>
</tr>
</tbody>
</table>
<p>Com 2 relacionamentos precisamos de ainda mais tempo para processar cada inserção: 1,37 vezes mais do que com 1 relacionamento. Também, podemos ver que parece que, enquanto a o banco de dados aumenta, leva mais tempo para executar cada insert.</p>
<p><strong>d) Quantidade de relacionamentos: 3</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.009.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">mín</td>
<td style="width: 120px; text-align: center;">0,093524 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">máx</td>
<td style="width: 120px; text-align: center;">0,650233 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">média</td>
<td style="width: 120px; text-align: center;">0,135843 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">271,7 s</td>
</tr>
</tbody>
</table>
<p>Com 3 relacionamentos o tempo médio foi ainda pior: 1,244 vezes mais que com 2 relacionamentos.</p>
<p><strong>Conclusão</strong></p>
<p>A seguinte tabela resulta dos testes realizados:</p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Teste</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo médio</strong></td>
<td style="width: 120px; text-align: center;"><strong>Tempo total</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">a</td>
<td style="width: 120px; text-align: center;">t1 ou 0,068631 s</td>
<td style="width: 120px; text-align: center;">t2 ou 137,3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">b</td>
<td style="width: 120px; text-align: center;">1,17 x t1 ou 0,080156 s</td>
<td style="width: 120px; text-align: center;">1,17 x t2 ou 160,3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">c</td>
<td style="width: 120px; text-align: center;">1,59 x t1 ou 0,109143 s</td>
<td style="width: 120px; text-align: center;">1,59 x t2 ou 218,3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">d</td>
<td style="width: 120px; text-align: center;">1,99 x t1 ou 0,135843 s</td>
<td style="width: 120px; text-align: center;">1,99 x t2 ou 271,7 s</td>
</tr>
</tbody>
</table>
<p>Como podemos ver, com o aumento do número de relacionamentos o tempo médio de inserção também aumenta. Este aumento não é linear.</p>
<p>O próximo post apresentará nossos resultados e conclusões para seleções no Core Data, acompanhe!</p>
<p>Este post também está disponível em inglês: <a title="Core Data over SQLite Performance Tests - Part 2" href="http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-2">Core Data over SQLite Performance Tests &#8211; Part 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Core Data over SQLite Performance Tests &#8211; Part 2</title>
		<link>http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-2/</link>
		<comments>http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-2/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 22:59:40 +0000</pubDate>
		<dc:creator>Raphael Petegrosso</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=119</guid>
		<description><![CDATA[Following the last post, Core Data over SQLite Performance Tests &#8211; Part 1, when we introduced Core Data and defined the environment in which tests will run on, now we are going to start presenting you the results of this analysis. As we defined before, this test will show the performance of 4 situations (see [...]]]></description>
			<content:encoded><![CDATA[<p>Following the last post, <a title="Core Data over SQLite Performance Tests - Part 1" href="http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-1">Core Data over SQLite Performance Tests &#8211; Part 1</a>, when we introduced Core Data and defined the environment in which tests will run on, now we are going to start presenting you the results of this analysis.</p>
<p>As we defined before, this test will show the performance of 4 situations (see details on the previous post):</p>
<ol style="margin-left: 25px;">
<li>Insert without join  tables;</li>
<li>Inserts with tables;</li>
<li>Select without join tables;</li>
<li>Select with join tables.</li>
</ol>
<p>This post will cover the first 2 situations (inserts).</p>
<h3><strong>1. Inserts without join tables</strong></h3>
<p>This test tries to execute 10000 inserts on 5 different ways:</p>
<ul>
<li>Batch size: 1; Times: 10000;</li>
<li>Batch size: 10; Times: 1000;</li>
<li>Batch size: 100; Times: 100;</li>
<li>Batch size: 1000; Times: 10;</li>
<li>Batch size: 10000; Times: 1.</li>
</ul>
<p>The results were the following:</p>
<p><strong>a) Batch size: 1; Times: 10000</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.001.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.037017 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.571604 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.047213 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">417.3 s</td>
</tr>
</tbody>
</table>
<p>As we can see on the chart, we have a slight variance between the inserts. Although the maximum chart value was 0.57 seconds, the average (0.047s) was much more close to the minimum value (0.037s). Also, we can see that the time needed to a insert does not changes significantly while the table increases.</p>
<p><strong>b) Batch size: 10; Times: 1000</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.002.png" alt="" title="" width="620" height="179" class="alignnone size-full wp-image-139" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.051545 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">1.592167 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.077328 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">77.3 s</td>
</tr>
</tbody>
</table>
<p>This case shown us that, increasing the batch size to 10 we need, on average, about 1.64x more time to execute this batch. So, we can imagine that is much better to execute a big batch than lot of small batches. The test shown that to insert 10000 registries with batch size of 10 we needed 77.3 s, while with batch size of 1, to insert 10000 registries we needed 417.3 s.</p>
<p><strong>c) Batch size: 100; Times: 100</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.003.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.221817 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.733436 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.276504 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">27.7 s</td>
</tr>
</tbody>
</table>
<p>This case shown that increasing again the batch size, now to 100, we needed about 3.6x more time per batch than we needed with batch size of 10. So, we can deduce that the time per batch does not increases linearly as the batch size increases. But again, the total time to execute 10000 inserts was lower (27 s against 77 s).</p>
<p><strong>d) Batch size: 1000; Times: 10</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.004.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">2.341496 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">2.895445 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">2.522845 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">25.2 s</td>
</tr>
</tbody>
</table>
<p>Again, the same happened. As we increases the batch size to 1000 we needed 9.1x more time than we needed with batch size of 100. The total time was better than the previous, but is almost the same (25 s against 27 s).</p>
<p><strong>e) Batch size: 10000; Times: 1 (10 repetitions with empty database)</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.005.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">19.171194 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">24.020913 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">22.2 s</td>
</tr>
</tbody>
</table>
<p>This time, increasing the batch size to 10000 we needed 8x more time than we needed with batch size of 1000, while we could imagine we would need more than 9.1. So, we needed only 22 s to execute 10000 inserts.</p>
<p><strong>Conclusion</strong></p>
<p>This tests resulted on the following table:</p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Test</strong></td>
<td style="width: 120px; text-align: center;"><strong>Average Time per Batch</strong></td>
<td style="width: 120px; text-align: center;"><strong>Total Time</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">a</td>
<td style="width: 120px; text-align: center;">t1 or 0.047213 s</td>
<td style="width: 120px; text-align: center;">t2 or 417.3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">b</td>
<td style="width: 120px; text-align: center;">1.83 x t1 or 0.077328 s</td>
<td style="width: 120px; text-align: center;">t2/5.40 or 77.3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">c</td>
<td style="width: 120px; text-align: center;">5.86 x t1 or 0.276504 s</td>
<td style="width: 120px; text-align: center;">t2/0.066 or 27.7 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">d</td>
<td style="width: 120px; text-align: center;">53.68 x t1 or 2.523 s</td>
<td style="width: 120px; text-align: center;">t2/0.060 or 25.2 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">e</td>
<td style="width: 120px; text-align: center;">470.34 x t1 or 22.2 s</td>
<td style="width: 120px; text-align: center;">t2/0.053 or 22.2 s</td>
</tr>
</tbody>
</table>
<p>As we can see, for simple inserts (without joins) as we increases the batch size, the time needed to to execute that batch is greater, but, the total time is lower. So, with Core Data, when possible we should save data to database using batches.</p>
<h3><strong>2. Inserts with join tables</strong></h3>
<p>This test shows how the time to execute a insert increases as the number of join tables (in each insert) and number of rows increases. The number of joins varies from 0 to 3.</p>
<p><strong>a) Joins quantity: 0</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.006.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.053622 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.626013 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.068631 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">137.3 s</td>
</tr>
</tbody>
</table>
<p>This test has no joins, so the results is the same from the previous test.</p>
<p><strong>b) Joins quantity: 1</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.007.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.617910 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.353416 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.080156 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">160.3 s</td>
</tr>
</tbody>
</table>
<p>As might be expected, with 1 join the average time to a insert was 1.17 times greater than with 0 joins.</p>
<p><strong>c) Joins quantity: 2</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.008.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.078214 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.559592 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.109143 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">218.3 s</td>
</tr>
</tbody>
</table>
<p>With 2 joins we needed even more time to process an insert: 1.37 times more than with 1 join. Also, we can see that it seems that, as the database increases, we need more time to do inserts that was join tables.</p>
<p><strong>d) Joins quantity: 3</strong></p>
<p><img src="http://i.ndigo.com.br/wp-content/uploads/2010/07/index.009.png" alt="" title="" width="618" height="194" class="alignnone size-full wp-image-124" /></p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">min</td>
<td style="width: 120px; text-align: center;">0.093524 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">max</td>
<td style="width: 120px; text-align: center;">0.650233 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">average</td>
<td style="width: 120px; text-align: center;">0.135843 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">total</td>
<td style="width: 120px; text-align: center;">271.7 s</td>
</tr>
</tbody>
</table>
<p>With 3 joins the average time was worst again: 1.244 times more than with 2 joins.</p>
<p><strong>Conclusion</strong></p>
<p>The following table results from the tests:</p>
<table style="margin-left: auto; margin-right: auto; height: 47px; margin-top: 50px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;"><strong>Test</strong></td>
<td style="width: 120px; text-align: center;"><strong>Average Time</strong></td>
<td style="width: 120px; text-align: center;"><strong>Total Time</strong></td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">a</td>
<td style="width: 120px; text-align: center;">t1 or 0.068631 s</td>
<td style="width: 120px; text-align: center;">t2 or 137.3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">b</td>
<td style="width: 120px; text-align: center;">1.17 x t1 or 0.080156 s</td>
<td style="width: 120px; text-align: center;">1.17 x t2 or 160.3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">c</td>
<td style="width: 120px; text-align: center;">1.59 x t1 or 0.109143 s</td>
<td style="width: 120px; text-align: center;">1.59 x t2 or 218.3 s</td>
</tr>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">d</td>
<td style="width: 120px; text-align: center;">1.99 x t1 or 0.135843 s</td>
<td style="width: 120px; text-align: center;">1.99 x t2 or 271.7 s</td>
</tr>
</tbody>
</table>
<p>As we can see, as the number of joins increases in a insert the time required to process it also increases. This increasing number is not linear. </p>
<p>The next post will present our results and conclusions for selects on Core Data, stay tuned!</p>
<p>This post is also available in Portuguese: <a title="Testes de performance do Core Data sobre SQLite - Parte 2" href="http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-2">Testes de performance do Core Data sobre SQLite &#8211; Parte 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testes de performance do Core Data sobre SQLite &#8211; Parte 1</title>
		<link>http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-1/</link>
		<comments>http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-1/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 21:45:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Go Tech]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=99</guid>
		<description><![CDATA[Dando sequência ao post da semana passada, Visão Geral de iPhone Persistent Store, a I.ndigo inicia a série de testes de performance das as alternativas de persistência de dados no iPhone com o framework oficial da Apple, o Core Data. Introdução Core Data foi disponibilizado para iPhone na versão 3.0 do SDK, apesar de já [...]]]></description>
			<content:encoded><![CDATA[<p>Dando sequência ao post  da semana passada, <a href="http://i.ndigo.com.br/2010/07/visao-geral-de-iphone-persistent-store/">Visão Geral de iPhone Persistent Store</a>, a I.ndigo  inicia a série de testes de performance das as alternativas de  persistência de dados no iPhone com o framework oficial da Apple, o Core  Data.</p>
<p><strong>Introdução</strong></p>
<p>Core Data foi  disponibilizado para iPhone na versão 3.0 do SDK, apesar de já existir  para Mac OSX há mais tempo. Esse framework implementa um Object Graph  Manager, que fornece funcionalidades de gerenciamento de dados,  incluindo inserção de dados, alterações dos mesmos, funcionalidade de  desfazer e refazer as mudanças, além da possibilidade de persistí-los.</p>
<p>O Core Data apresenta  uma API de alto nível, que abstrai as regras de gerência de dados, como  identificadores, consistência do modelo de dados, validação, além de  inserção, alteração e deleção de dados e criação e gerenciamento do  arquivo de persistência.</p>
<p>A abstração da modelagem de dados é obtida  por meio da ferramenta de modelagem de dados integrada no Xcode, onde o  desenvolvedor deve descrever os dados do sistema por meio de um diagrama  entidade-relacionamento. O Xcode se encarrega de gerar as classes e  arquivos necessários para a gerência e, opcionalmente, persistência dos  dados.</p>
<p>A camada de  persistência de dados abstrai do desenvolvedor os detalhes de  implementação do banco de dados. Na verdade, o SDK disponibiliza alguns  tipos de camada persistente, como banco de dados SQLite, formato binário  de arquivo e XML, este último disponível somente para Mac OSX.  Independentemente do tipo de persistência escolhida, o desenvolvedor  interage somente com objetos e suas propriedades.</p>
<h3><strong>Arquitetura do Core  Data<br />
</strong></h3>
<p>Para implementar todas  as funcionalidades descritas, foi escolhida uma arquitetura sólida e  flexível, como descrito no diagrama que segue.</p>
<div id="attachment_78" class="wp-caption aligncenter" style="width: 497px"><a href="http://i.ndigo.com.br/wp-content/uploads/2010/07/core_data_architecture.png"><img class="size-full wp-image-78" title="core_data_architecture" src="http://i.ndigo.com.br/wp-content/uploads/2010/07/core_data_architecture.png" alt="" width="487" height="506" /></a><p class="wp-caption-text">Core Data Architecture</p></div>
<ul>
<li><em>NSManagedObjectModel:</em> Criado em tempo de  execurtpxução, é baseado no modelo de dados do projeto, que é descrito  pelo desenvolvedor na ferramenta integrada de modelagem de dados.  Representa o modelo de dados do sistema;</li>
</ul>
<ul>
<li><em>NSManagedObject:</em> Representa cada entidade  e suas propriedades, modeladas pelo desenvolvedor. As propriedades  incluem atributos e relacionamentos;</li>
</ul>
<ul>
<li><em>NSManagedObjectContext:</em> Disponibiliza todas as  funcionalidades de gerspztssusrência de dados mencionadas, como busca,  inserção e deleção. Essa classe ssssé ciente e tem acesso ao Persistent  Store Coordinator;</li>
</ul>
<ul>
<li><em>NSPersistentStoreCoordinator:</em> Disponibiliza uma  interface para a camada de persistência de dados.</li>
</ul>
<p>Como citado, o Core Data  não limitado à persistência de dados. Todos as características de  gerenciamento de dados são separadas da camanda de persistência e podem  ser utilizadas sem ela.</p>
<h3><strong>Metodologia de testes<br />
</strong></h3>
<p><strong>Ambiente de testes</strong></p>
<table style="margin-left: auto; margin-right: auto; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">iPhone  3G 8GB</td>
<td style="width: 120px; text-align: center;">Xcode 3.2.3</td>
<td style="width: 120px; text-align: center;">iPhone SDK 4.0</td>
<td style="width: 120px; text-align: center;">iOS 4.0</td>
<td style="width: 120px; text-align: center;">Release Configuration</td>
</tr>
</tbody>
</table>
<p><strong>Modelo de dados<br />
</strong></p>
<p><strong> </strong></p>
<div id="attachment_80" class="wp-caption aligncenter" style="width: 518px"><strong><strong><a href="http://i.ndigo.com.br/wp-content/uploads/2010/07/datamodel.png"><img class="size-full wp-image-80" title="Data Model" src="http://i.ndigo.com.br/wp-content/uploads/2010/07/datamodel.png" alt="" width="508" height="299" /></a></strong></strong><p class="wp-caption-text">Data Model</p></div>
<p><strong> </strong></p>
<p><strong>Cenário de teste</strong></p>
<p>SQLite foi escolhido, ao  invés de um formato binário, uma vez que somente esse tipo é capaz de  carregar objetos parcialmente, por meio da funcionalidade de lazy loading, o que é muito  importante, tendo em vista que o desempenho do hardware do iPhone é  alto, porém limitado.</p>
<p>Além disso, foi consiserado suficiente para  os fins do teste um banco de dados de 10000 linhas, ou 10000 objetos  persistidos. O Core Data persiste dados salvando de uma vez todos os  objetos (NSManagedObject) presentes no contexto  (NSManagedObjectContext). Assim, a metodologia para os testes de  inserção prevê operações em lotes, de acordo com a tabela que segue.</p>
<table style="height: 124px; margin-left: auto; margin-right: auto;" width="273">
<tbody>
<tr style="text-align: center; border-top: solid 1px #aaa;">
<td><strong>Tamanho do lote</strong></td>
<td><strong>Repetições</strong></td>
</tr>
<tr style="text-align: center; border-top: solid 1px #aaa;">
<td>1</td>
<td>10000</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc;">
<td>10</td>
<td>1000</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc;">
<td>100</td>
<td>100</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc;">
<td>1000</td>
<td>10</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc; border-bottom: solid 1px #aaa;">
<td>10000</td>
<td>1</td>
</tr>
</tbody>
</table>
<p>Os seguintes testes  serão realizados:</p>
<ol style="margin-left: 25px;">
<li style="margin-bottom: 10px;"><em>Inserção sem relacionamentos</em><br />
O principal objetivo desse teste é avaliar a degradação de performance de acordo com o tamanho do banco de dados. Assim, seguindo a tabela acima, 10000 objetos serão persistidos.</li>
<li style="margin-bottom: 10px;"><em>Inserção com relacionamentos</em><br />
Nesse teste será medida a influência da quantidade de relacionamentos de uma entidade na performance da inserção. Serão inseridos 2000 objetos, com a quantidade de relaciomentos variando de nenhuma até quatro.</li>
<li style="margin-bottom: 10px;"><em>Busca sem relacionamentos</em><br />
Nesse teste serão abordados dois modos de busca: por propriedades e pelo identificador. Novamente serão inseridos e buscados 10000 objetos.</li>
<li style="margin-bottom: 10px;"><em>Busca com relacionamentos</em><br />
O último teste tem como objetivo medir a degradação de performance de acordo com a quantidade de relacionamentos de um entidade. Como esse é o teste mais custoso, os dados serão buscados a cada 100 inserções, até que se alcance 10000 objetos.</li>
</ol>
<p>Todos os testes se  completam para avaliar a degradação de performance do Core Data, em  relação ao tamanho da base de dados, bem como a quantidade de seus  relacionamentos.</p>
<p>O próximo post trará  nossos resultados e conclusões, acompanhe!</p>
<p>Este post também está  disponível em ingês: <a href="http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-1">Core Data over SQLite Performance Tests &#8211; Part 1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Core Data over SQLite Performance Tests &#8211; Part 1</title>
		<link>http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-1/</link>
		<comments>http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-1/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 21:45:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=77</guid>
		<description><![CDATA[Following the last post, iPhone Persistent Store Overview, I.ndigo begins the performance experiments series, on iPhone persistent store alternatives, with Core Data, Apple&#8217;s official framework for this purpose. Introduction Core Data for iPhone was introduced in the 3.0 version of the SDK, although it was previously available for Mac OSX. The framework implements an Object [...]]]></description>
			<content:encoded><![CDATA[<p>Following the last post, <a title="iPhone Persistent Store Overview" href="http://i.ndigo.com.br/2010/07/iphone-persistent-store-overview/">iPhone Persistent Store Overview</a>, I.ndigo begins the performance   experiments series, on iPhone persistent store alternatives, with Core   Data, Apple&#8217;s official framework for this purpose.</p>
<h3><strong>Introduction</strong></h3>
<p>Core Data for iPhone was  introduced in the 3.0 version of the SDK,  although it was previously  available for Mac OSX. The framework  implements an Object Graph Manager,  giving applications the ability to  manage data, including inserting new  records, applying changes, undoing  and redoing them and also the  ability persist them.<br />
It provides a  high level API that abstracts  all data management rules, as unique  identifiers, model consistency and  data validation, insertion, update  and deletion, as well as data store  creation and operation.</p>
<p>Data  modeling  abstraction is achieved by Xcode&#8217;s integrated graphical data  modeling  tool, where  the developer must describe an  entity-relationship diagram  representing and the system’s data. Xcode  then generates all the classes  and files needed to manage and  optionally persist the data.</p>
<p>The persistent store  layer  abstracts the database and file store to the developer. The iPhone  SDK  provides SQLite and a binary format and the Mac OSX SDK also  provides  XML persistence. Either way, the implementation details stay  apart from  the developer, who should only care about objects and its  properties.</p>
<h3><strong>Core  Data Architecture</strong></h3>
<p>To implement the  previously described  functionality, a flexible and solid architecture  was created, as seen  in the following diagram:</p>
<div id="attachment_78" class="wp-caption aligncenter" style="width: 497px"><a href="http://i.ndigo.com.br/wp-content/uploads/2010/07/core_data_architecture.png"><img class="size-full wp-image-78" title="core_data_architecture" src="http://i.ndigo.com.br/wp-content/uploads/2010/07/core_data_architecture.png" alt="" width="487" height="506" /></a><p class="wp-caption-text">Core Data Architecture</p></div>
<ul>
<li><em>NSManagedObjectModel:</em> Created on run-time,  based on the project&#8217;s data model, which is designed by the developer in  the integrated graphical tool, represents the hole system&#8217;s data;</li>
</ul>
<ul>
<li><em>NSManagedObject:</em> Represents each  entity and its properties, modeled by the developer. Those properties  includes attributes and relationships;</li>
</ul>
<ul>
<li><em>NSManagedObjectContext:</em> Provides all the  mentioned functionality to the Managed Objects, as fetching and  deletion; It is aware of and has access to the Persistent Store  Coordinator;</li>
</ul>
<ul>
<li><em>NSPersistentStoreCoordinator:</em> Provides an interface  to the data persistence layer.</li>
</ul>
<p>As mentioned before, Core  Data is not limited to data persistence. All aspects of data management  are separated from the persistence layer and can be used without it.</p>
<h3><strong>Testing Methodology</strong></h3>
<p><strong>Environment</strong></p>
<table style="margin-left: auto; margin-right: auto; height: 47px;" width="500">
<tbody>
<tr style="border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;">
<td style="width: 120px; text-align: center;">iPhone  3G 8GB</td>
<td style="width: 120px; text-align: center;">Xcode 3.2.3</td>
<td style="width: 120px; text-align: center;">iPhone SDK 4.0</td>
<td style="width: 120px; text-align: center;">iOS 4.0</td>
<td style="width: 120px; text-align: center;">Release Configuration</td>
</tr>
</tbody>
</table>
<p><strong>Data Model</strong></p>
<p><strong> </strong></p>
<div id="attachment_80" class="wp-caption aligncenter" style="width: 518px"><strong><strong><a href="http://i.ndigo.com.br/wp-content/uploads/2010/07/datamodel.png"><img class="size-full wp-image-80" title="Data Model" src="http://i.ndigo.com.br/wp-content/uploads/2010/07/datamodel.png" alt="" width="508" height="299" /></a></strong></strong><p class="wp-caption-text">Data Model</p></div>
<p><strong> </strong></p>
<p><strong>Testing Scenario<br />
</strong></p>
<p>SQLite was chosen over  binary format because it is the only type that is capable of partial  object graph loading, making use of the lazy fetching feature, what is  very important for the powerful, though limited iPhone hardware  capabilities.</p>
<p>Also,  a 10000 lines database, or 10000 persistent objects, was considered  enough for performance testing purpose. Core Data persists its objects  by saving all the NSManagedObjects present in the NSManagedObjectContext  by once. Therefore, the testing methodology for the insertion tests  included batch operations, with different of objects quantity per save,  as the following table describes:</p>
<table style="height: 124px; margin-left: auto; margin-right: auto;" width="273">
<tbody>
<tr style="text-align: center; border-top: solid 1px #aaa;">
<td><strong>Batch size</strong></td>
<td><strong>Times</strong></td>
</tr>
<tr style="text-align: center; border-top: solid 1px #aaa;">
<td>1</td>
<td>10000</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc;">
<td>10</td>
<td>1000</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc;">
<td>100</td>
<td>100</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc;">
<td>1000</td>
<td>10</td>
</tr>
<tr style="text-align: center; border-top: solid 1px #ccc; border-bottom: solid 1px #aaa;">
<td>10000</td>
<td>1</td>
</tr>
</tbody>
</table>
<p>The following testes  will be performed:</p>
<ol style="margin-left: 25px;">
<li style="margin-bottom: 10px;"><em>Insert without join  tables</em><br />
The main objective of  this test is to determine the insertion performance degradation,  according to the database size. Therefore, following the previous ta ble,  10000 objects will be persisted.</li>
<li style="margin-bottom: 10px;"><em>Insert with join  tables</em><br />
This test purpose is  to decide how much the number of table joins affect the performance.  Therefore, a smaller database will be used (2000 lines) with join  quantity from none to four.</li>
<li style="margin-bottom: 10px;"><em>Select without join  tables</em><br />
In this test two  approaches will be considered: fetching objects by its attributes and  getting them by their identifier. The performance is going to be  measured, until the persisted object&#8217;s count reaches 10000.</li>
<li style="margin-bottom: 10px;"><em>Select with join  tables</em><br />
This tests aims to  identify the selection performance degradation, according to the number  of object relationships (table joins). Since this is the heaviest test,  once the data must be inserted and then selected accordingly, data will  be selected after each 100 objects are inserted (atomically).</li>
</ol>
<p>All tests have as main  objective to determine the performance degradation of Core Data in  relation to the amount of persisted data and the number of relationships  between the data entities.</p>
<p>The next post will present our results and  conclusions, stay tuned!</p>
<p>This post is also available in Portuguese: <a href="http://i.ndigo.com.br/2010/07/testes-de-performance-do-core-data-sobre-sqlite-parte-1">Testes de performance do Core Data sobre SQLite &#8211; Parte 1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/07/core-data-over-sqlite-performance-tests-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Persistent Store Overview</title>
		<link>http://i.ndigo.com.br/2010/07/iphone-persistent-store-overview/</link>
		<comments>http://i.ndigo.com.br/2010/07/iphone-persistent-store-overview/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 23:24:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[persistence]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=62</guid>
		<description><![CDATA[Storing information over iPhone apps is a task that needs to be carefully taken and analyzed. We know an iPhone has limited resources that need to be used and released, properly. The problem is: what happens when you have an app that stores and load large amount of data (e.g, a Sales Force Automation Applications)? [...]]]></description>
			<content:encoded><![CDATA[<p>Storing information over iPhone apps is a task that needs to be carefully taken and analyzed. We know an iPhone has limited resources that need to be used and released, properly. The problem is: what happens when you have an app that stores and load large amount of data (e.g, a Sales Force Automation Applications)?</p>
<p>We don&#8217;t know how the application will respond to these data access with the time (as the database size increases). Moreover, we have lot of third-party options of persistence layer, or layers responsible to manage data access and data mapping to objects.</p>
<p>These third-party options may have other problems that could resulting in performance loss with the time. So, choosing the best for each situation isn&#8217;t an easy job.</p>
<p>Thus, I.ndigo has decided to begin a series   of performance experiments on the most known options of Persistent Store, and obviously, the Core Data purely implemented.</p>
<p>Searching on the web for options resulted on the following list of technologies:</p>
<div style="overflow-x: scroll;">
<table id="h-.j" style="border: 1px solid #ccc;" border="1" width="1000" align="center">
<tbody>
<tr>
<td width="11.11111111111111%"></td>
<td width="11.11111111111111%"><strong>Core Data</strong></td>
<td width="11.11111111111111%"><strong>FMDB</strong></td>
<td width="11.11111111111111%"><strong>Magical Panda</strong></td>
<td width="11.11111111111111%"><strong>Mogenerator</strong></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;"><strong>OmniDataObjects</strong></span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;"><strong>iphone-rsdb</strong></span></td>
<td width="11.11111111111111%"><strong>SQLite</strong></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;"><strong>SQLitePersistentObjects</strong></span></td>
</tr>
<tr>
<td width="11.11111111111111%">Abstraction level</td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">object graph manager</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">SQLite wrapper</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">ActiveRecord (over Core Data)</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">object graph manager</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">Core Data API implementation (over SQLite)</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">SQLite wrapper (based on fmdb)</span></td>
<td width="11.11111111111111%">-</td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">ActiveRecord over SQLite</span></td>
</tr>
<tr>
<td width="11.11111111111111%">belongs_to implementation</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
</tr>
<tr>
<td width="11.11111111111111%">has_many implementation</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
</tr>
<tr>
<td width="11.11111111111111%">many_to_many implementation</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">N/A</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
</tr>
<tr>
<td width="11.11111111111111%">SQL</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
</tr>
<tr>
<td width="11.11111111111111%">Lazy Loading</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
</tr>
<tr>
<td width="11.11111111111111%">License</td>
<td width="11.11111111111111%">iPhone Program</td>
<td width="11.11111111111111%">MIT</td>
<td width="11.11111111111111%">MIT</td>
<td width="11.11111111111111%">N/A</td>
<td width="11.11111111111111%">MIT</td>
<td width="11.11111111111111%">Apache 2.0</td>
<td width="11.11111111111111%">Public Domain</td>
<td width="11.11111111111111%">New BSD License</td>
</tr>
</tbody>
</table>
</div>
<div>This table also shows information about these technologies, which helped us to choose different options to test and compare one another. This table also shows whether there is any license limitation or need for a specific tool, such as SQL implementation.</p>
<p>Next posts will cover a serie of tests executed on some of these technologies and comparisons between them in several scenarios.</p>
<p>Stay tuned!</p>
<p>This post is also available in Portuguese: <a title="Visão Geral de iPhone Persistent Store" href="http://i.ndigo.com.br/2010/07/visao-geral-de-iphone-persistent-store/" target="_self">Visão Geral de iPhone Persistent Store</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/07/iphone-persistent-store-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visão Geral de iPhone Persistent Store</title>
		<link>http://i.ndigo.com.br/2010/07/visao-geral-de-iphone-persistent-store/</link>
		<comments>http://i.ndigo.com.br/2010/07/visao-geral-de-iphone-persistent-store/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 22:43:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Go Tech]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[magical panda]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://i.ndigo.com.br/?p=39</guid>
		<description><![CDATA[Armazenar informações em aplicações de iPhone é uma tarefa que deve ser cuidadosamente analisada. Sabemos que o iPhone tem limitações de recursos e que eles precisam ser usados e liberados de forma correta. O problema é: o que acontece quando você precisa de uma aplicação que armazena e carrega uma grande quantia de dados (como [...]]]></description>
			<content:encoded><![CDATA[<p>Armazenar  informações em aplicações de iPhone é uma tarefa que deve ser  cuidadosamente analisada. Sabemos que o iPhone tem limitações de  recursos e que eles precisam ser usados e liberados de forma correta. O  problema é: o que acontece quando você precisa de uma aplicação que  armazena e carrega uma grande quantia de dados (como um Sistema de  Automação de Força de Venda)?</p>
<p>Não sabemos se aplicação  iPhone se comportará bem nesses acessos (conforme o tamanho do banco de  dados aumenta). Além disso, há diversas opções de implementação de  camada de persistência desenvolvida por terceiro, ou seja, camada  responsável por gerenciar o acesso aos dados e seu mapeamento a objetos.</p>
<p>Estas  opções de terceiros podem ter outros problemas que, por sua vez, podem  resultar em perda de desempenho com o tempo. Assim, escolher o melhor  para cada situação não é fácil.</p>
<p>Portanto, a I.ndigo  decidiu realizar uma série de experimentos de desempenho nas opções mais  conhecidas de persistência de dados e também, obviamente, no Core Data  implementado puramente.</p>
<p>Ao buscar na web por opções tivemos a seguinte lista de tecnologias:</p>
<div style="overflow-x: scroll;">
<table id="h-.j" style="border: 1px solid #ccc;" border="1" width="1000" align="center">
<tbody>
<tr>
<td width="11.11111111111111%"></td>
<td width="11.11111111111111%"><strong>Core Data</strong></td>
<td width="11.11111111111111%"><strong>FMDB</strong></td>
<td width="11.11111111111111%"><strong>Magical Panda</strong></td>
<td width="11.11111111111111%"><strong>Mogenerator</strong></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;"><strong>OmniDataObjects</strong></span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;"><strong>iphone-rsdb</strong></span></td>
<td width="11.11111111111111%"><strong>SQLite</strong></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;"><strong>SQLitePersistentObjects</strong></span></td>
</tr>
<tr>
<td width="11.11111111111111%">Abstraction level</td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">object graph manager</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">SQLite wrapper</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">ActiveRecord (over Core Data)</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">object graph manager</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">Core Data API implementation (over SQLite)</span></td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">SQLite wrapper (based on fmdb)</span></td>
<td width="11.11111111111111%">-</td>
<td width="11.11111111111111%"><span style="font-family: arial,sans,sans-serif;">ActiveRecord over SQLite</span></td>
</tr>
<tr>
<td width="11.11111111111111%">belongs_to implementation</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
</tr>
<tr>
<td width="11.11111111111111%">has_many implementation</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
</tr>
<tr>
<td width="11.11111111111111%">many_to_many implementation</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">N/A</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
</tr>
<tr>
<td width="11.11111111111111%">SQL</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
</tr>
<tr>
<td width="11.11111111111111%">Lazy Loading</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
<td width="11.11111111111111%">yes</td>
<td width="11.11111111111111%">no</td>
</tr>
<tr>
<td width="11.11111111111111%">License</td>
<td width="11.11111111111111%">iPhone Program</td>
<td width="11.11111111111111%">MIT</td>
<td width="11.11111111111111%">MIT</td>
<td width="11.11111111111111%">N/A</td>
<td width="11.11111111111111%">MIT</td>
<td width="11.11111111111111%">Apache 2.0</td>
<td width="11.11111111111111%">Public Domain</td>
<td width="11.11111111111111%">New BSD License</td>
</tr>
</tbody>
</table>
</div>
<div>
<p>Esta tabela também mostra algumas informações sobre as tecnologias, que  nos ajudaram a escolher opções diferentes para testar e comparar. A  tabela também ajuda a escolher quando você tem limitações de licença ou  precisa de uma funcionalidade específica, como implementação de SQL.</p>
<p>Os  próximos posts cobrirão uma série de testes executados em algumas  dessas tecnologias e comparações entre elas em diversos cenários.</p>
<p>Acompanhe!</p>
<p>Este post também está disponível em inglês: <a title="iPhone Persistent Store Overview" href="http://i.ndigo.com.br/2010/07/iphone-persistent-store-overview/" target="_self">iPhone Persistent Store Overview</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://i.ndigo.com.br/2010/07/visao-geral-de-iphone-persistent-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

