From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sun, 20 Jun 2010 21:41:44 -0400 To: 9fans@9fans.net Message-ID: <81727c869e97f501968f868ee8794852@kw.quanstro.net> In-Reply-To: References: <97d3416a6d7cadb18e8723fff3d2e2a8@hamnavoe.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-utroyjxrgmhtxawpgmphxrshoh" Subject: Re: [9fans] interesting timing tests Topicbox-Message-UUID: 35d37016-ead6-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-utroyjxrgmhtxawpgmphxrshoh Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit oops. botched fix of harmess warning. corrected source attached. just for a giggle, i ran this test on a few handy machines to get a feel for relative speed of a single core. since this test is small enough to fit in the tiniest cache, i would think that memory speed or any other external factor would be unimportant: open rd/marvell kirkwood 471.97u 0.00s 472.25r Intel(R) Atom(TM) CPU 330 @ 1.60GHz 48.47u 0.00s 48.48r Intel(R) Pentium(R) 4 CPU 3.00GHz 40.72u 0.00s 40.76r AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ 30.62u 0.00s 30.64r AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 23.18u 0.00s 23.19r Intel(R) Xeon(R) CPU 5120 @ 1.86GHz 23.16u 0.00s 23.08r Intel(R) Xeon(R) CPU E5540 @ 2.53GHz 17.26u 0.00s 17.26r Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz 16.86u 0.00s 16.86r Intel(R) Xeon(R) CPU E5630 @ 2.53GHz 10.46u 0.00s 10.50r perhaps the arm's vlong arithmitic isn't as well optimized as x86. the atom also is conspicuously slow, but unfortunately with no obvious excuses. - erik --upas-utroyjxrgmhtxawpgmphxrshoh Content-Disposition: attachment; filename=burncycles.c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit #include #include #include #define Scale (100000000000ull) /* * waste time */ vlong πjj(uint j) { vlong v; v = 4*Scale / (2*j + 1); if(j&1) return -v; return v; } vlong π(void) { uint i; vlong v; v = 0; for(i = 0; i < 500000000; i++) v += πjj(i); return v; } void p(void *v) { int i; i = (int)v; print("%d: %lld\n", i, π()); threadexits(""); } void usage(void) { fprint(2, "usage: burncycles nthread\n"); threadexits("usage"); } void threadmain(int argc, char **argv) { int n, i; ARGBEGIN{ default: usage(); }ARGEND n = 0; if(argc == 0) n = 1; else if(argc != 1 || (n = atoi(argv[0])) <= 0) usage(); for(i = 0; i < n-1; i++) proccreate(p, (void*)i, 4096); p((void*)i); } --upas-utroyjxrgmhtxawpgmphxrshoh--