Re: A very slow program

Liste des GroupesRevenir à cl c 
Sujet : Re: A very slow program
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.c
Date : 02. Oct 2024, 16:41:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vdjm2s$394jf$1@dont-email.me>
References : 1
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 16.09.2024 00:45, Student Project wrote:
[ snip C program ]
/*
The result on my slow machine:
Program takes an average of 0.018000 seconds to find 78498 primes.
*/

Note, this is the same runtime magnitude that Unix'es 'primes'
command needs to run on 1000000 numbers to create 78498 primes
(0m00.01s) [on my very old (and slow) Unix system].

Is there a point in still writing own programs for that task?
I see some point when examining performance optimizations (as
someone downthread seems to have done). For cryptography there's
certainly demands for yet faster (parallelized) algorithms - if
quantum system algorithms don't make it superfluous (lately, or
in near future). But for cryptography you'd anyway need larger
numeric domains, beyond '[long]* integer' arithmetics. (I don't
know whether the [downthread posted] C++ code was designed to
support arbitrary length arithmetics.)

Optimized algorithms of new methods alone might not be a C topic.
But given your posting name, "Student Project", I suppose you're
anyway just using it as example for learning the C language?

For ordinary users it's probably sufficient to use an existing
program; on Unix 'primes 1 1000000000' runs in about 8 seconds.
And it's checking 2^32 numbers in 50 seconds (including 'wc'
and creating output [suppressed by redirection]), generating
50847534 primes. A simple prime test of some "arbitrary large"
number runs in no time, as does factorization of numbers with
the Unix'es 'factor' program. Just a simple command line call.
That existing 'primes' program also has some limit; the man page
documents a value of 4294967295, but no error message is created
for values up to around 1.8446744*10^19 on my system.

Janis

Date Sujet#  Auteur
16 Sep 24 * A very slow program21Student Project
16 Sep 24 +- Re: A very slow program1Kaz Kylheku
16 Sep 24 +* Re: A very slow program3Paul
2 Oct 24 i`* Re: A very slow program2Vir Campestris
2 Oct 24 i `- Re: A very slow program1Paul
2 Oct 24 +* Re: A very slow program14Bonita Montero
3 Oct 24 i+* OT: Re: A very slow program12Vir Campestris
4 Oct 24 ii`* Re: OT: Re: A very slow program11Bonita Montero
20 Oct 24 ii `* Re: OT: Re: A very slow program10Vir Campestris
20 Oct 24 ii  +* Re: OT: Re: A very slow program2Kenny McCormack
26 Oct 24 ii  i`- Re: OT: Re: A very slow program1Vir Campestris
21 Oct 24 ii  +* Re: OT: Re: A very slow program6Bonita Montero
26 Oct 24 ii  i`* Re: OT: Re: A very slow program5Vir Campestris
26 Oct 24 ii  i `* Re: OT: Re: A very slow program4Bonita Montero
26 Oct 24 ii  i  `* Re: OT: Re: A very slow program3Vir Campestris
27 Oct 24 ii  i   `* Re: OT: Re: A very slow program2Bonita Montero
28 Oct 24 ii  i    `- Re: OT: Re: A very slow program1Vir Campestris
22 Oct 24 ii  `- Re: OT: Re: A very slow program1Richard Harnden
3 Oct 24 i`- Re: A very slow program1Paul
2 Oct 24 `* Re: A very slow program2Janis Papanagnou
3 Oct 24  `- Re: A very slow program1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal