<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://dynamo.iro.umontreal.ca/wiki/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;feed=atom&amp;action=history</id>
		<title>Programming language shootout: nsieve - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;action=history"/>
		<updated>2013-06-19T09:53:30Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.4</generator>

	<entry>
		<id>http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=81&amp;oldid=prev</id>
		<title>Bjlucier: disabling performance is bad style and doesn't improve performance much</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=81&amp;oldid=prev"/>
				<updated>2008-02-26T14:02:10Z</updated>
		
		<summary type="html">&lt;p&gt;disabling performance is bad style and doesn&amp;#39;t improve performance much&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:02, 26 February 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; (let loop ((i 2)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; (let loop ((i 2)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	&amp;nbsp; &amp;nbsp; &amp;nbsp;  (n 0))&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	&amp;nbsp; &amp;nbsp; &amp;nbsp;  (n 0))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; (declare (not interrupts-enabled))&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (if (&amp;lt; i m)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; (if (&amp;lt; i m)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	&amp;nbsp; (if (bvector-true? a i)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;	&amp;nbsp; (if (bvector-true? a i)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bjlucier</name></author>	</entry>

	<entry>
		<id>http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=68&amp;oldid=prev</id>
		<title>Bjlucier: correct link to alioth</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=68&amp;oldid=prev"/>
				<updated>2008-02-22T22:00:10Z</updated>
		
		<summary type="html">&lt;p&gt;correct link to alioth&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:00, 22 February 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is a Gambit implementation of the [http://shootout.alioth.debian.org/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gp4&lt;/del&gt;/benchmark.php?test=nsieve&amp;amp;lang=all nsieve] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is a Gambit implementation of the [http://shootout.alioth.debian.org/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;gp4sandbox&lt;/ins&gt;/benchmark.php?test=nsieve&amp;amp;lang=all nsieve] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==The program==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==The program==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bjlucier</name></author>	</entry>

	<entry>
		<id>http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=55&amp;oldid=prev</id>
		<title>Bjlucier: spell nsieve correctly</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=55&amp;oldid=prev"/>
				<updated>2008-02-22T21:09:01Z</updated>
		
		<summary type="html">&lt;p&gt;spell nsieve correctly&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:09, 22 February 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is a Gambit implementation of the [http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsieve&amp;amp;lang=all &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nseive&lt;/del&gt;] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is a Gambit implementation of the [http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsieve&amp;amp;lang=all &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nsieve&lt;/ins&gt;] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==The program==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==The program==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bjlucier</name></author>	</entry>

	<entry>
		<id>http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=53&amp;oldid=prev</id>
		<title>Bjlucier: Added nsieve alioth benchmark</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve&amp;diff=53&amp;oldid=prev"/>
				<updated>2008-02-22T21:03:56Z</updated>
		
		<summary type="html">&lt;p&gt;Added nsieve alioth benchmark&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a Gambit implementation of the [http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsieve&amp;amp;lang=all nseive] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].&lt;br /&gt;
&lt;br /&gt;
==The program==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!gsi-script&lt;br /&gt;
;; $Id: nsieve.scm,v 1.3 2008/02/17 23:43:53 lucier Exp lucier $&lt;br /&gt;
;; The Great Computer Language Shootout&lt;br /&gt;
;; http://shootout.alioth.debian.org/&lt;br /&gt;
;;&lt;br /&gt;
;; nsieve benchmark for The Computer Language Shootout&lt;br /&gt;
;; Written by Dima Dorfman, 2004&lt;br /&gt;
;; Converted to MzScheme by Brent Fulgham&lt;br /&gt;
;; Converted to Gambit by Bradley Lucier&lt;br /&gt;
&lt;br /&gt;
(declare (standard-bindings)(extended-bindings)(block)(fixnum)(not safe))&lt;br /&gt;
&lt;br /&gt;
(define (nsieve m)&lt;br /&gt;
&lt;br /&gt;
  ;; vectors with #t or #f are too big to be allocated&lt;br /&gt;
  ;; on 32-bit machines for the size of arguments in the test&lt;br /&gt;
  &lt;br /&gt;
  (define (make-bvector n val)&lt;br /&gt;
    (make-u8vector n (if val 1 0)))&lt;br /&gt;
  &lt;br /&gt;
  (define (bvector-true? a i)&lt;br /&gt;
    (= (u8vector-ref a i) 1))&lt;br /&gt;
  &lt;br /&gt;
  (define (bvector-clear! a i)&lt;br /&gt;
    (u8vector-set! a i 0))&lt;br /&gt;
  &lt;br /&gt;
  (define (bvector-set! a i)&lt;br /&gt;
    (u8vector-set! a i 1))&lt;br /&gt;
  &lt;br /&gt;
  (let ((a (make-bvector m #t)))&lt;br /&gt;
    (let loop ((i 2)&lt;br /&gt;
	       (n 0))&lt;br /&gt;
      (declare (not interrupts-enabled))&lt;br /&gt;
      (if (&amp;lt; i m)&lt;br /&gt;
	  (if (bvector-true? a i)&lt;br /&gt;
	      (let clear ((j (+ i i)))&lt;br /&gt;
		(if (&amp;lt; j m)&lt;br /&gt;
		    (begin&lt;br /&gt;
		      (bvector-clear! a j)&lt;br /&gt;
		      (clear (+ j i)))&lt;br /&gt;
		    (loop (+ 1 i)&lt;br /&gt;
			  (+ 1 n))))&lt;br /&gt;
	      (loop (+ 1 i) n))&lt;br /&gt;
	  n))))&lt;br /&gt;
&lt;br /&gt;
(define (test n)&lt;br /&gt;
  &lt;br /&gt;
  (define (string-pad s n)&lt;br /&gt;
    (string-append (make-string (- n (string-length s)) #\space)&lt;br /&gt;
		   s))&lt;br /&gt;
  &lt;br /&gt;
  (let* ((m (* (expt 2 n) 10000))&lt;br /&gt;
	 (count (nsieve m)))&lt;br /&gt;
    (display (list &amp;quot;Primes up to &amp;quot;&lt;br /&gt;
		   (string-pad (number-&amp;gt;string m) 8)&lt;br /&gt;
		   &amp;quot; &amp;quot;&lt;br /&gt;
		   (string-pad (number-&amp;gt;string count) 8)&lt;br /&gt;
		   #\newline))))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(define (main arg)&lt;br /&gt;
  (let ((n (string-&amp;gt;number arg)))&lt;br /&gt;
    (if (not n)&lt;br /&gt;
	(begin&lt;br /&gt;
	  (display &amp;quot;An integer is required&amp;quot;) (newline) 2)&lt;br /&gt;
	(begin&lt;br /&gt;
	  (if (&amp;gt;= n 0) (test n))&lt;br /&gt;
	  (if (&amp;gt;= n 1) (test (- n 1)))&lt;br /&gt;
	  (if (&amp;gt;= n 2) (test (- n 2)))&lt;br /&gt;
	  0))))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Compiling==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gsc nsieve&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Running==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gsi nsieve 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bjlucier</name></author>	</entry>

	</feed>