<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Forgot to mention, though: The more idiomatic/shorter way to write
something like this would be to perform a reduction on a
(non-parallel, lazy, random access) std.parallelism.Map. The map
function will be evaluated in parallel naturally, as the parallel
reduction is performed. Maybe this should be an example in the docs
for reduce. In your pi example:<br>
<br>
// Nested function inside main().<br>
double calculateTerm(int i) {<br>
immutable x = (i - 0.5) * delta ;<br>
return 1.0 / (1.0 + x * x);<br>
}<br>
<br>
immutable sum = taskPool.reduce!"a + b"(<br>
std.algorithm.map!calculateTerm(iota(n))<br>
);<br>
<br>
<br>
<br>
On 3/3/2011 8:58 AM, David Simcha wrote:
<blockquote cite="mid:4D6F9E7D.5090702@gmail.com" type="cite">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
Unfortunately I already played around with this, and it seems it
absolutely requires double precision, or else it blows up
numerically. I want to avoid double precision in my benchmarks so
that stack alignment artifacts will not creep in.<br>
<br>
On 3/3/2011 4:30 AM, Russel Winder wrote:
<blockquote cite="mid:1299144617.26060.7.camel@anglides"
type="cite">
<pre wrap="">On Sat, 2011-02-26 at 14:54 -0500, David Simcha wrote:
</pre>
<blockquote type="cite">
<pre wrap="">BTW, is it ok if I include your pi calculating benchmark in the
benchmarks folder, too? (I may modify it to make it slightly more
idiomatic.)
</pre>
</blockquote>
<pre wrap="">No problem.
It would be interesting to see what changes you make: idiomatic is
always good :-)
</pre>
<pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
phobos mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:phobos@puremagic.com">phobos@puremagic.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.puremagic.com/mailman/listinfo/phobos">http://lists.puremagic.com/mailman/listinfo/phobos</a></pre>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>