<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Is a dictionary or an array faster?]]></title><description><![CDATA[<p dir="auto">If I have position x and y and rotation and want to be setting objects to those values, would it faster to have them as keys in a dictionary, or as indexes in an array?</p>
]]></description><link>https://forum.hyperpad.com/topic/802/is-a-dictionary-or-an-array-faster</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 19:57:39 GMT</lastBuildDate><atom:link href="https://forum.hyperpad.com/topic/802.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Dec 2017 03:28:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Is a dictionary or an array faster? on Thu, 14 Dec 2017 12:46:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/deeeds" aria-label="Profile: Deeeds">@<bdi>Deeeds</bdi></a> thanks!</p>
]]></description><link>https://forum.hyperpad.com/post/5406</link><guid isPermaLink="true">https://forum.hyperpad.com/post/5406</guid><dc:creator><![CDATA[iTap Development]]></dc:creator><pubDate>Thu, 14 Dec 2017 12:46:30 GMT</pubDate></item><item><title><![CDATA[Reply to Is a dictionary or an array faster? on Thu, 14 Dec 2017 03:49:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/itap-development" aria-label="Profile: iTap-Development">@<bdi>iTap-Development</bdi></a> when in doubt, use arrays.</p>
<p dir="auto">Arrays are faster for almost everything, by an order of magnitude. Particularly in Objective-C, which is how they'd be implemented.</p>
<p dir="auto">The process of looking up, via a key, is quite slow, when compared with index lookups of arrays.</p>
<p dir="auto">When it comes to iterating through one or the other, arrays are often much more than an order of magnitude faster due to their inherently streamlined memory usage.</p>
<p dir="auto">Then there's unpacking.</p>
<p dir="auto">When you store x, y and rotation in a dictionary at a key, you have to "unpack" that to use it, which takes even longer.</p>
<p dir="auto">So you're best off having an array for each:</p>
<p dir="auto">arrayX<br />
arrayY<br />
arrayRotation<br />
arrayObjectName</p>
<p dir="auto">and iterating through when you need.</p>
]]></description><link>https://forum.hyperpad.com/post/5356</link><guid isPermaLink="true">https://forum.hyperpad.com/post/5356</guid><dc:creator><![CDATA[Deeeds]]></dc:creator><pubDate>Thu, 14 Dec 2017 03:49:09 GMT</pubDate></item></channel></rss>