Difference between revisions of "Comparing Different Computers with N Queens Program"

From dftwiki3
Jump to: navigation, search
(N-Queens on a 16 MHz Arduino)
 
(22 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
<br />
 
<br />
 
<br />
 
<br />
 
+
=Source Code=
 
+
<br />
Here are some results gathered in Oct. 2014 on several systems I have access to.  NxN is the dimension of the board.  The different systems are:
+
The N-Queens program in C is available [[N-Queens_in_C| here]].  The N-Queens in Java is available [[N-Queens_Problem_in_Java|here]] and also [[N-Queens_In_Java,_Counting_the_Number_of_Probes|here]].
 +
<br />
 +
=Timing=
 +
<br />
 +
Here are some results gathered on several different processor systems.  NxN is the dimension of the board.  The different systems are:
 
# Macbook Pro, 2009, 2.53 GHz, Intel Core 2 Duo, 8GB 1067MHz DDR3, 2 cores  
 
# Macbook Pro, 2009, 2.53 GHz, Intel Core 2 Duo, 8GB 1067MHz DDR3, 2 cores  
 
# Macbook Pro, 2014,  2.8 GHz Core i7, 16GB 1600MHz DDR3, 4 cores
 
# Macbook Pro, 2014,  2.8 GHz Core i7, 16GB 1600MHz DDR3, 4 cores
Line 17: Line 21:
 
# Laptop 1 = MSI GE62 Apache Pro 219, 2015, i7 5700hq @2.7GHz, 16.0 GB 1600MHz DDR3L, 4 cores
 
# Laptop 1 = MSI GE62 Apache Pro 219, 2015, i7 5700hq @2.7GHz, 16.0 GB 1600MHz DDR3L, 4 cores
 
# Linux 8 = AMD FX(tm)-8320 Eight-Core Processor, 3.5 GHz, 2GB cache
 
# Linux 8 = AMD FX(tm)-8320 Eight-Core Processor, 3.5 GHz, 2GB cache
 +
# Arduino = Diecimilia,  ATMega168 processor @ 16 MHz.
 +
# Raspberry Pi 3, processor at 1.2 GHz
 
<br />
 
<br />
 
All times in the table below are in milliseconds (ms).
 
All times in the table below are in milliseconds (ms).
Line 32: Line 38:
 
! Laptop 1
 
! Laptop 1
 
! Linux 8
 
! Linux 8
 +
! Arduino
 +
! Rasberry Pi 3
 
|-
 
|-
 
|
 
|
Line 216: Line 224:
 
</source>
 
</source>
 
|
 
|
<source lang="text".
+
<source lang="text">
 +
0
 +
0
 +
0
 +
0
 +
0
 
1
 
1
 +
9
 +
6
 +
33
 +
23
 +
60
 +
16
 +
99
 +
29
 +
463
 +
58
 +
157
 +
64
 +
161
 +
184
 +
938
 +
522
 +
17252
 +
</source>
 +
|
 +
<source lang="text">
 +
493
 +
2,585
 +
14,016
 +
81,831
 +
512,952
 +
3,387,865
 +
23,779,229
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
NA
 +
</source>
 +
|
 +
<source lang="text">
 +
0
 +
0
 +
0
 +
0
 
0
 
0
1
 
 
0
 
0
 
1
 
1
 
1
 
1
13
+
7
40
+
4
80
+
29
44
+
2
168
+
148
42
+
7
247
+
1372
 +
21
 +
369
 +
47
 +
381
 +
424
 +
2884
 +
1512
 +
55523
 
</source>
 
</source>
 
|}
 
|}
Line 237: Line 307:
 
==Comparing Java to C==
 
==Comparing Java to C==
 
<br />
 
<br />
This calls for a quick comparison of the Java to C implementation available [[N-Queens in C|here]], compiled by a C++ compiler with O3 optimization, and running on the fastest of the machines above, a MacBook Pro, 15" Retina Display, with a 2.8GHz 4-core processor.  The computation uses only core.  All times are in milliseconds (ms).
+
This calls for a quick comparison of the Java to C implementation available [[N-Queens in C|here]], compiled by a C++ compiler with O3 optimization, and running on the fastest of the machines above, a MacBook Pro, 15" Retina Display, with a 2.8GHz 4-core processor.  The computation uses only one core.  All times are in milliseconds (ms).
 
<br />
 
<br />
 
<center>
 
<center>
Line 329: Line 399:
 
For more information on the difference between Java, C, Python, and Assembly, go to this [[Speed_of_Instructions:_Nasm,_Java,_C%2B%2B_and_Python_comparison| page]].
 
For more information on the difference between Java, C, Python, and Assembly, go to this [[Speed_of_Instructions:_Nasm,_Java,_C%2B%2B_and_Python_comparison| page]].
 
<br />
 
<br />
 +
 +
<br />
 +
=N-Queens on a 16 MHz Arduino=
 
<br />
 
<br />
 +
The code for the N-Queens on the Arduino is available [[N-Queens on the Arduino| here]].
 
<br />
 
<br />
 +
<center>
 +
{| class="wikitable"
 +
|-
 +
! NxN
 +
! Elapsed Time in ms
 +
|-
 +
|
 +
<source lang="text">
 +
8x8
 +
9x9
 +
10x10
 +
11x11
 +
12x12
 +
13x13
 +
14x14
 +
</source>
 +
|
 +
<source lang="text">
 +
493
 +
2,585
 +
14,016
 +
81,831
 +
512,952
 +
3,387,865
 +
23,779,229
 +
</source>
 +
|}
 +
</center>
 
<br />
 
<br />
 +
Note that 3,387,865 ms is 56 min, 28 seconds, and that 23,779,229 is 6 hours and 36 minutes!  The Arduino is  almost 6 and a half hours computing a result that took a Desktop machine less than 10 milliseconds to compute (Java or C++).
 
<br />
 
<br />
 
<br />
 
<br />
Line 337: Line 440:
 
<br />
 
<br />
 
<br />
 
<br />
[[Category:Java]][[Category:Python]][[Category:C++]][[Category:Nasm]]
+
[[Category:Java]][[Category:Python]][[Category:C++]][[Category:Nasm]][[Category:Arduino]]

Latest revision as of 10:30, 12 February 2017

--D. Thiebaut (talk) 11:05, 24 October 2014 (EDT)



This is an example of how one can generate a quick comparison of the processing power of different systems using a CPU-bound (not using disk or network) application. This app in this case is a java program that finds the solution to the N-Queens problem while counting the number of probes it makes to the 2-D board. The source code is available here.



Source Code


The N-Queens program in C is available here. The N-Queens in Java is available here and also here.

Timing


Here are some results gathered on several different processor systems. NxN is the dimension of the board. The different systems are:

  1. Macbook Pro, 2009, 2.53 GHz, Intel Core 2 Duo, 8GB 1067MHz DDR3, 2 cores
  2. Macbook Pro, 2014, 2.8 GHz Core i7, 16GB 1600MHz DDR3, 4 cores
  3. MacPro, 2009, Intel(R) Xeon(R) CPU E5462, 4 cores
  4. MacPro, 2014, Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz, 6 cores
  5. Beowulf2, (year?) Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz, 1 core
  6. Laptop 1 = MSI GE62 Apache Pro 219, 2015, i7 5700hq @2.7GHz, 16.0 GB 1600MHz DDR3L, 4 cores
  7. Linux 8 = AMD FX(tm)-8320 Eight-Core Processor, 3.5 GHz, 2GB cache
  8. Arduino = Diecimilia, ATMega168 processor @ 16 MHz.
  9. Raspberry Pi 3, processor at 1.2 GHz


All times in the table below are in milliseconds (ms).

NxN Macbook Pro
2009
Macbook Pro
2014
MacPro
2009
MacPro
2014
Linux Mint
Beowulf2
Laptop 1 Linux 8 Arduino Rasberry Pi 3
8x8
9x9
10x10
11x11
12x12
13x13
14x14
15x15
16x16
17x17
18x18
19x19
20x20
21x21
22x22
23x23
24x24
25x25
26x26
27x27
28x28
29x29
30x30
0
0
0
0
1
0
26
17
37
28
87
19
144
36
750
81
242
92
248
284
1551
1518
33667
1
0
1
0
1
0
3
2
14
10
34
7
64
13
311
31
101
37
102
118
633
356
12586
0
1
0
0
1
0
8
5
27
19
67
13
119
26
662
63
199
72
201
232
1250
687
23558
1
0
0
0
0
0
5
2
18
13
41
9
70
17
384
39
119
44
121
142
734
413
14158
0
0
0
0
1
1
17
14
46
31
104
22
152
50
610
101
226
111
227
257
1213
684
22889
0
0
0
0
0
0
0
0
1
1
5
1
24
1
221
3
56
7
58
69
469
244
9041
0
0
0
0
0
1
9
6
33
23
60
16
99
29
463
58
157
64
161
184
938
522
17252
493
2,585
14,016
81,831
512,952
3,387,865
23,779,229
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
NA
0
0
0
0
0
0
1
1
7
4
29
2
148
7
1372
21
369
47
381
424
2884
1512
55523


Comparing Java to C


This calls for a quick comparison of the Java to C implementation available here, compiled by a C++ compiler with O3 optimization, and running on the fastest of the machines above, a MacBook Pro, 15" Retina Display, with a 2.8GHz 4-core processor. The computation uses only one core. All times are in milliseconds (ms).

NxN Java
1.7.0_60
C
Compiled with g++
& -O3 optimization
8x8
9x9
10x10
11x11
12x12
13x13
14x14
15x15
16x16
17x17
18x18
19x19
20x20
21x21
22x22
23x23
24x24
25x25
26x26
27x27
28x28
29x29
30x30
1
0
1
0
1
0
3
2
14
10
34
7
64
13
311
31
101
37
102
118
633
356
12586
0
0
0
0
0
0
0
0
1
0
4
0
17
1
159
2
40
5
40
49
319
170
6320


For more information on the difference between Java, C, Python, and Assembly, go to this page.


N-Queens on a 16 MHz Arduino


The code for the N-Queens on the Arduino is available here.

NxN Elapsed Time in ms
8x8
9x9
10x10
11x11
12x12
13x13
14x14
493
2,585
14,016
81,831
512,952
3,387,865 
23,779,229


Note that 3,387,865 ms is 56 min, 28 seconds, and that 23,779,229 is 6 hours and 36 minutes! The Arduino is almost 6 and a half hours computing a result that took a Desktop machine less than 10 milliseconds to compute (Java or C++).