-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTIMING
73 lines (51 loc) · 963 Bytes
/
TIMING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Print all primes less than 100000
--
$ time ./sieve1 100000 | wc -l
9592
real 1m33.599s
user 1m31.124s
sys 0m0.547s
$ time ./sieve2 100000 | wc -l
9592
real 0m0.601s
user 0m0.463s
sys 0m0.113s
$ time ./sieve3 100000 | wc -l
9592
real 0m0.251s
user 0m0.167s
sys 0m0.097s
Print the millionth prime
--
$ time ./sieve2 -n 1000000
15485863
real 0m45.854s
user 0m45.460s
sys 0m0.123s
$ time ./sieve3 -n 1000000
15485863
real 0m10.953s
user 0m10.859s
sys 0m0.050s
$ time ./sieve3 -ncpu 2 -n 1000000
15485863
real 0m16.763s
user 0m17.975s
sys 0m8.696s
$ time ./ONeillPrimesTest 1000000
(1000000,15485863)
real 0m5.553s
user 0m5.526s
sys 0m0.007s
Print the ten-millionth prime
--
$ time ./sieve3 -n 10000000
179424673
real 2m41.634s
user 2m39.920s
sys 0m0.470s
$ time ./ONeillPrimesTest 10000000
(10000000,179424673)
real 1m33.626s
user 1m32.661s
sys 0m0.253s