<?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-bits&amp;feed=atom&amp;action=history</id>
		<title>Programming language shootout: nsieve-bits - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&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-bits&amp;action=history"/>
		<updated>2013-05-22T21:29: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-bits&amp;diff=2231&amp;oldid=prev</id>
		<title>Bjlucier: /* Running */</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&amp;diff=2231&amp;oldid=prev"/>
				<updated>2009-03-24T00:54:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Running&lt;/span&gt;&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 00:54, 24 March 2009&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 86:&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;==Running==&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;==Running==&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;lt;pre&amp;gt;&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;lt;pre&amp;gt;&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;gsi nsieve 11&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;gsi nsieve&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-bits &lt;/ins&gt;11&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;lt;/pre&amp;gt;&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;lt;/pre&amp;gt;&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-bits&amp;diff=82&amp;oldid=prev</id>
		<title>Bjlucier: disabling interrupts is bad form and doesn't help performance</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&amp;diff=82&amp;oldid=prev"/>
				<updated>2008-02-26T14:05:30Z</updated>
		
		<summary type="html">&lt;p&gt;disabling interrupts is bad form and doesn&amp;#39;t help performance&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:05, 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 40:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 40:&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-bits&amp;diff=69&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-bits&amp;diff=69&amp;oldid=prev"/>
				<updated>2008-02-22T22:00:56Z</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=nsievebits&amp;amp;lang=all nsieve-bits] 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=nsievebits&amp;amp;lang=all nsieve-bits] 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-bits&amp;diff=54&amp;oldid=prev</id>
		<title>Bjlucier: Add nsieve-bits alioth benchmark</title>
		<link rel="alternate" type="text/html" href="http://dynamo.iro.umontreal.ca/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&amp;diff=54&amp;oldid=prev"/>
				<updated>2008-02-22T21:08:17Z</updated>
		
		<summary type="html">&lt;p&gt;Add nsieve-bits 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=nsievebits&amp;amp;lang=all nsieve-bits] 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-bits.scm,v 1.2 2008/02/17 23:44:02 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;
  (define (make-bvector n val)&lt;br /&gt;
    (make-u8vector (quotient (+ n 7) 8)&lt;br /&gt;
		   (if val 255 0)))&lt;br /&gt;
  &lt;br /&gt;
  (define (bvector-true? a i)&lt;br /&gt;
    (not (zero? (fxand (u8vector-ref a (quotient i 8))&lt;br /&gt;
		       (fxarithmetic-shift-left 1 (remainder i 8))))))&lt;br /&gt;
  &lt;br /&gt;
  (define (bvector-clear! a i)&lt;br /&gt;
    (let* ((index (quotient i 8))&lt;br /&gt;
	   (byte (u8vector-ref a index))&lt;br /&gt;
	   (mask (fxarithmetic-shift-left 1 (remainder i 8))))&lt;br /&gt;
      (u8vector-set! a index (fxand byte (fxnot mask)))))&lt;br /&gt;
  &lt;br /&gt;
  (define (bvector-set! a i)&lt;br /&gt;
    (let* ((index (quotient i 8))&lt;br /&gt;
	   (byte (u8vector-ref a index))&lt;br /&gt;
	   (mask (fxarithmetic-shift-left 1 (remainder i 8))))&lt;br /&gt;
      (u8vector-set! a index (fxior byte mask))))&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;
  &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;
&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-bits&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 11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bjlucier</name></author>	</entry>

	</feed>