<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: Merging Ruby Hashes And Bang Method Usage</title> <atom:link href="http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/feed/" rel="self" type="application/rss+xml" /><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/</link> <description>For the betterment of the software craft...</description> <lastBuildDate>Mon, 21 Nov 2011 13:57:06 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.2</generator> <item><title>By: Nick</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-7515</link> <dc:creator>Nick</dc:creator> <pubDate>Wed, 28 Sep 2011 20:37:44 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-7515</guid> <description>Thanks!!@!! that helped out a ton!</description> <content:encoded><![CDATA[<p>Thanks!!@!! that helped out a ton!</p> ]]></content:encoded> </item> <item><title>By: Zatoichi</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-7231</link> <dc:creator>Zatoichi</dc:creator> <pubDate>Tue, 05 Jul 2011 01:51:29 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-7231</guid> <description>Thank you bro!!! Very useful</description> <content:encoded><![CDATA[<p>Thank you bro!!! Very useful</p> ]]></content:encoded> </item> <item><title>By: Ruby, NewRelicRPM, Font-face, Redis, testing, etc. &#171; turnings</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-5409</link> <dc:creator>Ruby, NewRelicRPM, Font-face, Redis, testing, etc. &#171; turnings</dc:creator> <pubDate>Tue, 11 May 2010 16:18:04 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-5409</guid> <description>[...] merging-ruby-hashes-and-bang-method-usage [...]</description> <content:encoded><![CDATA[<p>[...] merging-ruby-hashes-and-bang-method-usage [...]</p> ]]></content:encoded> </item> <item><title>By: Alan Skorkin</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4908</link> <dc:creator>Alan Skorkin</dc:creator> <pubDate>Sat, 01 May 2010 15:01:28 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4908</guid> <description>Hey  Marek,
Very interesting, well it&#039;s good to know that JRuby is at least more or less consistent :).</description> <content:encoded><![CDATA[<p>Hey  Marek,</p><p>Very interesting, well it&#8217;s good to know that JRuby is at least more or less consistent :).</p> ]]></content:encoded> </item> <item><title>By: Marek Kowalcze</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4903</link> <dc:creator>Marek Kowalcze</dc:creator> <pubDate>Sat, 01 May 2010 09:59:26 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4903</guid> <description>When I added --1.9 switch (which is compatible with 1.9.2dev) it fell down to about 70times faster with merge! (using nailgun).</description> <content:encoded><![CDATA[<p>When I added &#8211;1.9 switch (which is compatible with 1.9.2dev) it fell down to about 70times faster with merge! (using nailgun).</p> ]]></content:encoded> </item> <item><title>By: Marek Kowalcze</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4902</link> <dc:creator>Marek Kowalcze</dc:creator> <pubDate>Sat, 01 May 2010 09:55:10 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4902</guid> <description>Hi
I run some tests on JRuby to compare if someone&#039;s interested:
http://gist.github.com/386194
In general in JRuby the difference between merge and merge it&#039;s even larger..
On my machine:
# On Ruby i686-linux 1.9.1 merge! is 42.8203960017727 faster than merge.
# On Ruby java 1.8.7 merge! is 772.361024112707 faster than merge.  (first run)
However, using nailgun (http://sourceforge.net/projects/nailgun/):
# On Ruby java 1.8.7 merge! is 92.3685496183206 faster than merge.
# On Ruby java 1.8.7 merge! is 102.961025482799 faster than merge.
# On Ruby java 1.8.7 merge! is 207.121184088807 faster than merge.
# ...</description> <content:encoded><![CDATA[<p>Hi<br
/> I run some tests on JRuby to compare if someone&#8217;s interested:<br
/> <a
href="http://gist.github.com/386194" rel="nofollow">http://gist.github.com/386194</a></p><p>In general in JRuby the difference between merge and merge it&#8217;s even larger..<br
/> On my machine:<br
/> # On Ruby i686-linux 1.9.1 merge! is 42.8203960017727 faster than merge.<br
/> # On Ruby java 1.8.7 merge! is 772.361024112707 faster than merge.  (first run)<br
/> However, using nailgun (<a
href="http://sourceforge.net/projects/nailgun/" rel="nofollow">http://sourceforge.net/projects/nailgun/</a>):<br
/> # On Ruby java 1.8.7 merge! is 92.3685496183206 faster than merge.<br
/> # On Ruby java 1.8.7 merge! is 102.961025482799 faster than merge.<br
/> # On Ruby java 1.8.7 merge! is 207.121184088807 faster than merge.<br
/> # &#8230;</p> ]]></content:encoded> </item> <item><title>By: Alan Skorkin</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4894</link> <dc:creator>Alan Skorkin</dc:creator> <pubDate>Fri, 30 Apr 2010 00:19:23 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4894</guid> <description>Hi Jonas,
Yeah, if you can restrict it to just doing the merge once, that certainly helps a lot, my example was contrived in that I was creating the small hashes, but with my real problem I already had a bunch of little hashes which I wanted to merge into one, so no matter how I spun it I would have to do a lot of merges.</description> <content:encoded><![CDATA[<p>Hi Jonas,</p><p>Yeah, if you can restrict it to just doing the merge once, that certainly helps a lot, my example was contrived in that I was creating the small hashes, but with my real problem I already had a bunch of little hashes which I wanted to merge into one, so no matter how I spun it I would have to do a lot of merges.</p> ]]></content:encoded> </item> <item><title>By: Jonas Elfström</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4892</link> <dc:creator>Jonas Elfström</dc:creator> <pubDate>Thu, 29 Apr 2010 15:07:09 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4892</guid> <description>I guess that it only was an example and that it wasn&#039;t possible to do something like this instead?
main_hash = {}
time = Benchmark.realtime do
simple_hash = {}
(1..10000).each do &#124;number&#124;
simple_hash[number.to_s] = number
end
main_hash = main_hash.merge(simple_hash)
end
puts &quot;Time elapsed #{time} seconds&quot;
puts &quot;Main hash key count: #{main_hash.keys.count}&quot;
Time elapsed 0.133629083633423 seconds</description> <content:encoded><![CDATA[<p>I guess that it only was an example and that it wasn&#8217;t possible to do something like this instead?</p><p>main_hash = {}<br
/> time = Benchmark.realtime do<br
/> simple_hash = {}<br
/> (1..10000).each do |number|<br
/> simple_hash[number.to_s] = number<br
/> end<br
/> main_hash = main_hash.merge(simple_hash)<br
/> end<br
/> puts &#8220;Time elapsed #{time} seconds&#8221;<br
/> puts &#8220;Main hash key count: #{main_hash.keys.count}&#8221;</p><p>Time elapsed 0.133629083633423 seconds</p> ]]></content:encoded> </item> <item><title>By: Alan Skorkin</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4888</link> <dc:creator>Alan Skorkin</dc:creator> <pubDate>Thu, 29 Apr 2010 10:35:13 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4888</guid> <description>Yeah that makes sense, good thing to keep in mind if performance is important.</description> <content:encoded><![CDATA[<p>Yeah that makes sense, good thing to keep in mind if performance is important.</p> ]]></content:encoded> </item> <item><title>By: Thomas Thomassen</title><link>http://www.skorks.com/2010/04/merging-ruby-hashes-and-bang-method-usage/comment-page-1/#comment-4886</link> <dc:creator>Thomas Thomassen</dc:creator> <pubDate>Thu, 29 Apr 2010 09:03:56 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1738#comment-4886</guid> <description>As to &lt;code&gt;for&lt;/code&gt; vs &lt;code&gt;each&lt;/code&gt;: we (the plugin developers that linger around SCF) have a thread going where this topic was brought up. http://forums.sketchucation.com/viewtopic.php?f=180&amp;t=25305#p220844
The difference can be significant. All though, this will be different from Ruby 1.8 and 1.9. Sketchup uses 1.8. If you are creating variables within the loop then the &lt;code&gt;for&lt;/code&gt; loop will be faster because the variables are not locale to the loop.  Difference in the test was at times double. But if you init the variables used in the &lt;code&gt;each&lt;/code&gt; loop then the differences isn&#039;t very noticeable.</description> <content:encoded><![CDATA[<p>As to <code>for</code> vs <code>each</code>: we (the plugin developers that linger around SCF) have a thread going where this topic was brought up. <a
href="http://forums.sketchucation.com/viewtopic.php?f=180&#038;t=25305#p220844" rel="nofollow">http://forums.sketchucation.com/viewtopic.php?f=180&#038;t=25305#p220844</a></p><p>The difference can be significant. All though, this will be different from Ruby 1.8 and 1.9. Sketchup uses 1.8. If you are creating variables within the loop then the <code>for</code> loop will be faster because the variables are not locale to the loop.  Difference in the test was at times double. But if you init the variables used in the <code>each</code> loop then the differences isn&#8217;t very noticeable.</p> ]]></content:encoded> </item> </channel> </rss>
