<?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: Solving Project Euler Problems With Ioke</title>
	<atom:link href="http://www.peterkrantz.com/2009/project-euler-in-ioke/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterkrantz.com/2009/project-euler-in-ioke/</link>
	<description>A blog about technology, visualization, music and unmanned vehicle experiments</description>
	<lastBuildDate>Tue, 20 Jul 2010 05:03:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Ola Bini</title>
		<link>http://www.peterkrantz.com/2009/project-euler-in-ioke/comment-page-1/#comment-2435</link>
		<dc:creator>Ola Bini</dc:creator>
		<pubDate>Sun, 04 Jan 2009 12:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/?p=256#comment-2435</guid>
		<description>Hey,

So, I&#039;ve made one change on trunk so that the cost of creating all those numbers aren&#039;t as high. The reason being that originally, every time a number is in code, that will be translated into a internal:createNumber message. This message will run every time a number is encountered, and will as such create all those 11 to 20 numbers every time in the loop. It will also create quite a few copies of 0. This has been changed on trunk. Since numbers and texts are immutable in themselves, the first time it will be cached.

The large difference I got was when running with --server, though. For long running processes, that is definitely recommend.

Without my number-fixes, I got:
232792560
ruby p5.rb  8,28s user 0,07s system 95% cpu 8,786 total
232792560
ioke p5.ik  3224,51s user 54,80s system 96% cpu 56:46,65 total
232792560
ioke --server p5.ik  1076,38s user 23,17s system 99% cpu 18:20,49 total

So as you can see, running with --server cuts the time down to a third. It&#039;s still 20 minutes running time, but much better than without it.

I&#039;m going to do a new run with the number caching and see what happens.</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>So, I&#8217;ve made one change on trunk so that the cost of creating all those numbers aren&#8217;t as high. The reason being that originally, every time a number is in code, that will be translated into a internal:createNumber message. This message will run every time a number is encountered, and will as such create all those 11 to 20 numbers every time in the loop. It will also create quite a few copies of 0. This has been changed on trunk. Since numbers and texts are immutable in themselves, the first time it will be cached.</p>
<p>The large difference I got was when running with &#8211;server, though. For long running processes, that is definitely recommend.</p>
<p>Without my number-fixes, I got:<br />
232792560<br />
ruby p5.rb  8,28s user 0,07s system 95% cpu 8,786 total<br />
232792560<br />
ioke p5.ik  3224,51s user 54,80s system 96% cpu 56:46,65 total<br />
232792560<br />
ioke &#8211;server p5.ik  1076,38s user 23,17s system 99% cpu 18:20,49 total</p>
<p>So as you can see, running with &#8211;server cuts the time down to a third. It&#8217;s still 20 minutes running time, but much better than without it.</p>
<p>I&#8217;m going to do a new run with the number caching and see what happens.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://www.peterkrantz.com/2009/project-euler-in-ioke/comment-page-1/#comment-2433</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Sat, 03 Jan 2009 19:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/?p=256#comment-2433</guid>
		<description>Brute force of #5 in Ruby:

&lt;code&gt;
n = 20

def is_divisible(n)
	(n % 20 == 0 and 
	n % 19 == 0 and 
	n % 18 == 0 and
	n % 17 == 0 and
	n % 16 == 0 and
	n % 15 == 0 and
	n % 14 == 0 and
	n % 13 == 0 and
	n % 12 == 0 and
	n % 11 == 0)
end

while !is_divisible(n) do
    n = n + 20
end

print n
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Brute force of #5 in Ruby:</p>
<pre class="brush: plain;">DQpuID0gMjANCg0KZGVmIGlzX2RpdmlzaWJsZShuKQ0KCShuICUgMjAgPT0gMCBhbmQgDQoJbiAlIDE5ID09IDAgYW5kIA0KCW4gJSAxOCA9PSAwIGFuZA0KCW4gJSAxNyA9PSAwIGFuZA0KCW4gJSAxNiA9PSAwIGFuZA0KCW4gJSAxNSA9PSAwIGFuZA0KCW4gJSAxNCA9PSAwIGFuZA0KCW4gJSAxMyA9PSAwIGFuZA0KCW4gJSAxMiA9PSAwIGFuZA0KCW4gJSAxMSA9PSAwKQ0KZW5kDQoNCndoaWxlICFpc19kaXZpc2libGUobikgZG8NCiAgICBuID0gbiArIDIwDQplbmQNCg0KcHJpbnQgbg0K</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://www.peterkrantz.com/2009/project-euler-in-ioke/comment-page-1/#comment-2432</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Sat, 03 Jan 2009 19:25:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/?p=256#comment-2432</guid>
		<description>The brute force version of #5:

&lt;code&gt;
n = 20

until(n % 20 == 0 and 
  n % 19 == 0 and 
  n % 18 == 0 and
  n % 17 == 0 and
  n % 16 == 0 and
  n % 15 == 0 and
  n % 14 == 0 and
  n % 13 == 0 and
  n % 12 == 0 and
  n % 11 == 0,

  n = n + 20
)

n println
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>The brute force version of #5:</p>
<pre class="brush: plain;">DQpuID0gMjANCg0KdW50aWwobiAlIDIwID09IDAgYW5kIA0KICBuICUgMTkgPT0gMCBhbmQgDQogIG4gJSAxOCA9PSAwIGFuZA0KICBuICUgMTcgPT0gMCBhbmQNCiAgbiAlIDE2ID09IDAgYW5kDQogIG4gJSAxNSA9PSAwIGFuZA0KICBuICUgMTQgPT0gMCBhbmQNCiAgbiAlIDEzID09IDAgYW5kDQogIG4gJSAxMiA9PSAwIGFuZA0KICBuICUgMTEgPT0gMCwNCg0KICBuID0gbiArIDIwDQopDQoNCm4gcHJpbnRsbg0K</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ola Bini</title>
		<link>http://www.peterkrantz.com/2009/project-euler-in-ioke/comment-page-1/#comment-2431</link>
		<dc:creator>Ola Bini</dc:creator>
		<pubDate>Sat, 03 Jan 2009 18:42:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/?p=256#comment-2431</guid>
		<description>Cool,

Could you post the brute force version of 5 too? I would be interested in seeing what takes so much time, since the looping is pretty fast. Although - I don&#039;t look too much at performance. =)</description>
		<content:encoded><![CDATA[<p>Cool,</p>
<p>Could you post the brute force version of 5 too? I would be interested in seeing what takes so much time, since the looping is pretty fast. Although &#8211; I don&#8217;t look too much at performance. =)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
