Thoughts on Prime Number Generation Challenge and a Possible Spin-Off #932
Replies: 3 comments 5 replies
-
I'm converting this to an Ideas discussion. |
Beta Was this translation helpful? Give feedback.
-
@JamesLear92 I'm not exactly sure I understand how you envisage implementing this in a practical sense? We have close to 450 benchmarked implementations in the project at the moment, all of which have been developed in accordance with the current rules. Which are actually rules I am personally happy with - and I do acknowledge I can easily be accused of bias -, to a large extent because I think they are a good translation of the original challenge. That challenge being figuring out which language/implementation is the fastest at identifying prime numbers, which does not necessarily include the fastest approach towards converting the identified primes to an easy-to-digest format. Still, I'd be interested to know how you'd structure this separate/spin-off challenge, in the context of the implementations that are already there. |
Beta Was this translation helpful? Give feedback.
-
Parallelism is complicated. Also the space used to represent primes
can be tuned.
The array space reduction can be clever.
The easy space saver is Odd/Even so the array of bits can be half the
search space. With each prime the space can be reduced.
Or the results of a searched block encoded into an answer structure.
Is this in the mix? Hadoop can be on an N core CPU or an N core cluster.
https://saturncloud.io/blog/parallel-algorithms-for-generating-prime-numbers/
It makes sense to limit these to CPU and unpaged Memory
…On Mon, Sep 11, 2023 at 1:05 PM enki42 ***@***.***> wrote:
There is an issue I see with the rules in this regard. This one:
Your benchmarked code returns either a list of primes or the is_prime array, containing the result of the sieve.
If you write multithreaded code does this list or just the count need to be passed into some form of controller thread? The overhead of data being shared between threads can be high (copy the data so no shared memory between threads, lock the data so there is more context switching, etc) This can also impact reuse of the memory space taken up by the array/collection of primes.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
--
T o m M i t c h e l l (on NiftyEgg[.]com )
|
Beta Was this translation helpful? Give feedback.
-
Hello
Really enjoying the prime number generation challenge.
Most newcomers might be creating a usable list or array of primes when comparing their results to these benchmarks. It's a more intuitive approach since anyone writing a function to produce prime numbers wants to see the numbers it produced, but this is a disadvantage in this challenge as these conversions aren't factored into the benchmark.
Currently, we're generating a bitarray to show primes as 1s and 0s, or true and false. To make it actually usable, we convert it to a list or array of primes. In the current rules, we're just creating a count to verify the results after the benchmark, but this just highlights that a bitarray isn't really what we want from the code.
So, here's an idea: A separate challenge that requires usable data generation - A list or array of primes. This way, we can bench the entire process and keep the benchmarks slightly more real world relevant.
Newcomers are going to start off with a naive implementation that returns actual primes, it's a tiny bit of a shame they can't begin their optimisation journey from there, rather than the unfamiliar deep end.
Maybe it's worth a shot?
Cheers,
James
Beta Was this translation helpful? Give feedback.
All reactions