Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

computer languages speed race at Dave's garage

252 views
Skip to first unread message

Lorenzo Lodi

unread,
Jul 24, 2021, 2:58:25 AM7/24/21
to
I wanted to call your attention to an on-going series of videos on the
YouTube channel Dave's garage:
https://www.youtube.com/watch?v=pv4Yq35Chx0


This all began when the author of the Youtube channel recounted that he
implemented a prime number sieve as an exercise in his school years in
the '80s, and now wanted to run exactly the same benchmark using modern
languages (initially, C# and Python).
This proved very popular, and watchers have submitted their
implementations in lots of languages (61 and counting), including Fortran.
Specifically, the goal is to implement a prime number sieve for primes
up to a million, closely following the algorithm in a reference
implementation (in C#).
In every episode of the series the author consider a couple of
implementations in similar languages (e.g., C# and Java), discusses a
bit the languages and then shows the results of the benchmarks.

There is a Github repository with all the implementations
https://github.com/PlummersSoftwareLLC/Primes

At the moment there are two Fortran implementations, one Fortran 2003
and 2008.
https://github.com/PlummersSoftwareLLC/Primes/tree/drag-race/PrimeFortran

I think it's be great if some of the Fortran experts had a look at those
implementations and, perhaps, improved them if possible.
I think if Fortran did well this would be good publicity for the general
public. I found some benchmarks (for older implementations, as they are
updated all the time) here:
https://www.reddit.com/r/fsharp/comments/oezbnv/daves_garage_prime_numbers_laguages_benchmark/

The list above indicates that the fastest implementations are in C and
zig (a language I'd never heard of), with the Fortran implementation far
behind (although many of those results look very strange, so take them
with a pinch of salt).

Lorenzo

gah4

unread,
Jul 24, 2021, 6:28:42 AM7/24/21
to
On Friday, July 23, 2021 at 11:58:25 PM UTC-7, Lorenzo Lodi wrote:
> I wanted to call your attention to an on-going series of videos on the
> YouTube channel Dave's garage:
> https://www.youtube.com/watch?v=pv4Yq35Chx0
>
>
> This all began when the author of the Youtube channel recounted that he
> implemented a prime number sieve as an exercise in his school years in
> the '80s, and now wanted to run exactly the same benchmark using modern
> languages (initially, C# and Python).

The C version realizes that the word of bits to clear repeats cyclically through
the loop. The Fortran version generates the bits one at a time, each time.
Even more, the Fortran version uses divide and mod for each one, though
the compiler might do it with shift and AND operations. Still, the bitwise
computations are likely intensive.




Robin Vowels

unread,
Jul 24, 2021, 11:19:07 PM7/24/21
to
.
Implementations of the algorithm in various languages
can be found at rosetta code.
0 new messages