Add example about std.parallelism#1760
Conversation
wilzbach
commented
Jun 22, 2017

17184b6 to
fd6230b
Compare
| import std.math, std.parallelism, std.stdio; | ||
|
|
||
| auto logs = new double[1_000_000]; | ||
|
|
There was a problem hiding this comment.
Might want to initialise it to iota. Also since the point is to parallelise it maybe add sone timing code to show that it runs faster?
|
Eh, this is a bit boring. More interesting would be to calculate and print an actual result, such as I don't know, like sum of all prime numbers up to a point. Needs some ideas. taskPool.reduce and parallel sorting are also more interesting. |
|
Maybe a benchmark to showcase the difference between parallel and non-parallel foreach. I'm not too concerned about the example being "interesting" in the sense of doing something complicated / clever; the point of a frontpage example is to show off the language, not the cleverness of the example writer. I think the key with |
|
Here's a rough example that shows the difference: |
|
It can probably use some trimming down to size to fit on the front page :D |
Sure, but calculating a result to memory then throwing it away is not great either. |
|
OK, maybe parallel reduce might be more interesting? Like summing an array of 1,000,000 doubles. |
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
fd6230b to
9022594
Compare
Tried to trim it down a bit. We might want to play with the array sizes a bit. So the performance of the DLang-Tour backend, isn't that bad ;-)
Hmm this (iteration of a list in parallel) is actually my most common use of |
9022594 to
0c17c3d
Compare
0c17c3d to
213e1c5
Compare
|
So ... imho just showing off how easy & beautiful @CyberShadow what do you think? |
|
Oh yeah, |
Not browser specific BTW |
Btw: I guess you don't have |
|
Interesting that the bot doesn't merge this ... will investigate. |
|
I saw the following in the logs: ... Will upgrade the bot to Vibe 0.8.0 later -maybe that helps. |
That's a Microsoft font and IIRC not a core web font so that's probably it. |
FYI: dlang/dlang-bot#137 (deployed the upgrade of the bot to Vibe 0.8.0) |

