From c68398617b861e79ca9425f6cc983cd434f191b0 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Thu, 6 Aug 2009 14:21:21 -0700 Subject: [PATCH] mandelbrot R=rsc DELTA=147 (145 added, 0 deleted, 2 changed) OCL=32840 CL=32845 --- test/bench/mandelbrot.c | 91 ++++++++++++++++++++++++++++++++++++ test/bench/mandelbrot.go | 95 ++++++++++++++++++++++++++++++++++++++ test/bench/mandelbrot.txt | Bin 0 -> 5011 bytes test/bench/timing.log | 9 +++- test/bench/timing.sh | 11 ++++- 5 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 test/bench/mandelbrot.c create mode 100644 test/bench/mandelbrot.go create mode 100644 test/bench/mandelbrot.txt diff --git a/test/bench/mandelbrot.c b/test/bench/mandelbrot.c new file mode 100644 index 00000000000..c177c088ca6 --- /dev/null +++ b/test/bench/mandelbrot.c @@ -0,0 +1,91 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of "The Computer Language Benchmarks Game" nor the + name of "The Computer Language Shootout Benchmarks" nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +/* The Computer Language Shootout + http://shootout.alioth.debian.org/ + + contributed by Greg Buchholz + + for the debian (AMD) machine... + compile flags: -O3 -ffast-math -march=athlon-xp -funroll-loops + + for the gp4 (Intel) machine... + compile flags: -O3 -ffast-math -march=pentium4 -funroll-loops +*/ + +#include + +int main (int argc, char **argv) +{ + int w, h, bit_num = 0; + char byte_acc = 0; + int i, iter = 50; + double x, y, limit = 2.0; + double Zr, Zi, Cr, Ci, Tr, Ti; + + w = h = atoi(argv[1]); + + printf("P4\n%d %d\n",w,h); + + for(y=0;yt+5w54e-K1Pi9{2f5H=Eh(os{T%|FOhG!)4X zh{Q=y&_M%)eB3ZQYoBNAeUZ|FrSq-#`OWNn?Ch?eK3Lk?+#JboiF((d*Ym%3{6G#E z10Z`10J<@-d@a~NiqbuOampSwP(!0Ckz-1h;a)s;HU=Ii29ng;~E2} zX-2^S$a&IdY|}R7!0nU8S++XraR!g}n15Eiexeu0%zSvKiwv@{^z->{2gn{vG~}9f zQ)}>1To|rh8J)cbeD6qsUJT1c?eC`pzmLFG_1ww2%~2Bb+l$KTSmZJ?_ygO1l6cqG zmze{i6#@J00V-<(Uvz+B1F+XYMGLr5wK_T`-faozZd69a!~#|Aslan?y#J{c_02N! z&n@uF0_$zRAJv)xt}J8O0uzI@&XqSR0~o`3h5+ZpCq@UqGop;)zMvdf#%as2x+P6p zpbe}t&9F)<$}(~bn4*>KSfKIyis&jV5F<6B(K8wzSzua^N+y@{VIA8s3DesVl^3h8 zwy2(FwY*p{-)!*96p)pr$aFreD`vs`r=vVtE&wNi4FUE|g34noPK7k42|HwIkZesU zmwrC;qSU~L0hoC}ov2-x2~l}q@SfhAo4O>v>qV)7vCA_wf`#%upvog~+=$nI1#)dB zfFc1LhL}g-yTZ+_l34GT`s9I$0J8`*@5X--l+6m?7oNgY^Kq!(35F+u;C1iSni1^F z>$dxwbkb}N3IQ^(4mheL5bS`KV_zZf!gw@*53NQpI>iH;4260E0()~ug@!VQ+T{Vw zM3}pIf}z>2qEhn%&M2)SsX2&eZ6VrI^PDyWfR&+>c=IBYtUkD2p$bQ^Cc-L81nTZJ zm3l=oFW5i7G=d@LB_ns{z0zn_gMj1~Fzbh3ilR%x`{V($rux;uG7hYc(vMu!0fZ%tAn}4#vUq8lnD7FneVqf{k+kXLujJ|XL literal 0 HcmV?d00001 diff --git a/test/bench/timing.log b/test/bench/timing.log index d1731386e8f..520b18dd05b 100644 --- a/test/bench/timing.log +++ b/test/bench/timing.log @@ -1,4 +1,4 @@ -All tests on r45 +All tests on r45 or r70 Aug 3 2009 @@ -73,3 +73,10 @@ k-nucleotide 5000000 gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0 k-nucleotide.c: 10.72u 0.01s 10.74r gccgo -O2 k-nucleotide.go 22.69u 0.85s 24.09r gc k-nucleotide 15.63u 0.26s 16.41r + gc_B k-nucleotide 17.22u 0.04s 17.28r + +mandelbrot 5500 + gcc -O2 mandelbrot.c 56.13u 0.02s 56.17r + gccgo -O2 mandelbrot.go 57.49u 0.01s 57.51r + gc mandelbrot 74.32u 0.00s 74.35r + gc_B mandelbrot 74.28u 0.01s 74.31r diff --git a/test/bench/timing.sh b/test/bench/timing.sh index 7af19194f51..600cacb91c1 100755 --- a/test/bench/timing.sh +++ b/test/bench/timing.sh @@ -91,12 +91,21 @@ knucleotide() { run 'gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0' a.out