Twin Primes Segmented Sieve of Zakiya (SSoZ) Explained

I just released this new paper which prominently features Rust code.

Twin Primes Segmented Sieve of Zakiya (SSoZ) Explained
(PDF) Twin Primes Segmented Sieve of Zakiya (SSoZ) Explained | Jabari Zakiya - Academia.edu)

Over the past few years I've gotten help in developing the code from the Forum and thought
I'd share the results of the refined code's comparative performance to some other languages.

I previously had posted about it here.

Recently I asked about using bitarrays here.

Actually the bitarray implementation seems just as fast (with much simpler|shorter code) but I don't use it for the reference implementation for the paper (yet) until its implementation becomes better.

Allot of refinements in the code, and performance increases have occurred, as Rust has developed.

Here are the Rust sources for the code in the paper.

twinprimes_ssoz

cousinprimes_ssoz

I'm really interested in seeing the code's performance on other hardware, e.g. an M1, ARM, Risc, etc.

1 Like

I just updated the paper, to reflect code changes that eliminated 2 potential places in the code where arithmetic overflow would occur. I also fixed some typos, cleaned up some language and described some things simpler|clearer. Please get the updated paper|code (from previous links in initial post), dated yesterday, June 28, 2022 -Tau Day (link describing below).

Nice link, but you should clarify that's not the link for the paper.

Ah, OK. I thought it should be obvious what that link is to.
I amended the previous post to make it (I hope) clear now.

1 Like

I just recompiled with new version 1.62 and compared against 1.60.
At least for this code, 1.62 is appreciably slower than compiled with 1.60.

As an example for this input, 1.62 is over 240 secs (4 minutes) slower!

For 10^14 input: $ echo 100000000000000 | ./twinprimes_ssoz'
the times are: 1.60 - 3734 secs (1hr 2m 14s): 1.62 - 3977 secs (1hr 6m 17s)

Though 1.61 is also slower than 1.60 it was no way this large a difference.
This seems to be a big speed regression in 1.62 since 1.60

You can run the code on your systems and see for yourselves.

I would file a perf regression issue.

Submitted.

https://github.com/rust-lang/rust/issues/98902

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.