https://gambitscheme.org/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&feed=atom&action=history
Programming language shootout: nsieve-bits - Revision history
2024-03-28T09:06:31Z
Revision history for this page on the wiki
MediaWiki 1.35.3
https://gambitscheme.org/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&diff=2231&oldid=prev
Bjlucier: /* Running */
2009-03-24T00:54:45Z
<p><span dir="auto"><span class="autocomment">Running</span></span></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 00:54, 24 March 2009</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l86" >Line 86:</td>
<td colspan="2" class="diff-lineno">Line 86:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Running==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Running==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>gsi nsieve 11</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>gsi nsieve<ins class="diffchange diffchange-inline">-bits </ins>11</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
</table>
Bjlucier
https://gambitscheme.org/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&diff=82&oldid=prev
Bjlucier: disabling interrupts is bad form and doesn't help performance
2008-02-26T14:05:30Z
<p>disabling interrupts is bad form and doesn't help performance</p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 14:05, 26 February 2008</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l40" >Line 40:</td>
<td colspan="2" class="diff-lineno">Line 40:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (let loop ((i 2)</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (let loop ((i 2)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (n 0))</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (n 0))</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> (declare (not interrupts-enabled))</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (if (< i m)</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (if (< i m)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (if (bvector-true? a i)</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> (if (bvector-true? a i)</div></td></tr>
</table>
Bjlucier
https://gambitscheme.org/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&diff=69&oldid=prev
Bjlucier: correct link to alioth
2008-02-22T22:00:56Z
<p>correct link to alioth</p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 22:00, 22 February 2008</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>This is a Gambit implementation of the [http://shootout.alioth.debian.org/<del class="diffchange diffchange-inline">gp4</del>/benchmark.php?test=nsievebits&lang=all nsieve-bits] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This is a Gambit implementation of the [http://shootout.alioth.debian.org/<ins class="diffchange diffchange-inline">gp4sandbox</ins>/benchmark.php?test=nsievebits&lang=all nsieve-bits] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The program==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The program==</div></td></tr>
</table>
Bjlucier
https://gambitscheme.org/wiki/index.php?title=Programming_language_shootout:_nsieve-bits&diff=54&oldid=prev
Bjlucier: Add nsieve-bits alioth benchmark
2008-02-22T21:08:17Z
<p>Add nsieve-bits alioth benchmark</p>
<p><b>New page</b></p><div>This is a Gambit implementation of the [http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lang=all nsieve-bits] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]].<br />
<br />
==The program==<br />
<pre><br />
#!gsi-script<br />
;; $Id: nsieve-bits.scm,v 1.2 2008/02/17 23:44:02 lucier Exp lucier $<br />
;; The Great Computer Language Shootout<br />
;; http://shootout.alioth.debian.org/<br />
;;<br />
;; nsieve benchmark for The Computer Language Shootout<br />
;; Written by Dima Dorfman, 2004<br />
;; Converted to MzScheme by Brent Fulgham<br />
;; Converted to Gambit by Bradley Lucier<br />
<br />
(declare (standard-bindings)(extended-bindings)(block)(fixnum)(not safe))<br />
<br />
(define (nsieve m)<br />
<br />
(define (make-bvector n val)<br />
(make-u8vector (quotient (+ n 7) 8)<br />
(if val 255 0)))<br />
<br />
(define (bvector-true? a i)<br />
(not (zero? (fxand (u8vector-ref a (quotient i 8))<br />
(fxarithmetic-shift-left 1 (remainder i 8))))))<br />
<br />
(define (bvector-clear! a i)<br />
(let* ((index (quotient i 8))<br />
(byte (u8vector-ref a index))<br />
(mask (fxarithmetic-shift-left 1 (remainder i 8))))<br />
(u8vector-set! a index (fxand byte (fxnot mask)))))<br />
<br />
(define (bvector-set! a i)<br />
(let* ((index (quotient i 8))<br />
(byte (u8vector-ref a index))<br />
(mask (fxarithmetic-shift-left 1 (remainder i 8))))<br />
(u8vector-set! a index (fxior byte mask))))<br />
<br />
(let ((a (make-bvector m #t)))<br />
(let loop ((i 2)<br />
(n 0))<br />
(declare (not interrupts-enabled))<br />
(if (< i m)<br />
(if (bvector-true? a i)<br />
(let clear ((j (+ i i)))<br />
(if (< j m)<br />
(begin<br />
(bvector-clear! a j)<br />
(clear (+ j i)))<br />
(loop (+ 1 i)<br />
(+ 1 n))))<br />
(loop (+ 1 i) n))<br />
n))))<br />
<br />
(define (test n)<br />
<br />
(define (string-pad s n)<br />
(string-append (make-string (- n (string-length s)) #\space)<br />
s))<br />
<br />
(let* ((m (* (expt 2 n) 10000))<br />
(count (nsieve m)))<br />
(display (list "Primes up to "<br />
(string-pad (number->string m) 8)<br />
" "<br />
(string-pad (number->string count) 8)<br />
#\newline))))<br />
<br />
<br />
(define (main arg)<br />
<br />
(let ((n (string->number arg)))<br />
(if (not n)<br />
(begin<br />
(display "An integer is required") (newline) 2)<br />
(begin<br />
(if (>= n 0) (test n))<br />
(if (>= n 1) (test (- n 1)))<br />
(if (>= n 2) (test (- n 2)))<br />
0))))<br />
<br />
</pre><br />
==Compiling==<br />
<pre><br />
gsc nsieve-bits<br />
</pre><br />
==Running==<br />
<pre><br />
gsi nsieve 11<br />
</pre></div>
Bjlucier