Which of these 3 CPU's would be fastest...

insomniac3334

Distinguished
Jan 12, 2012
58
0
18,630
I have an algorithm I wrote in Java that essentially calculates anagrams of words. I have a looooonoog list of words that I need to process, and the professor has said it could take hours to even days depending on some implementation details.

There are 3 computers I can choose from to compute this algorithm:

Computer A: (Desktop) Core 2 Quad Q9400 2.66GHz Quad-Core/6GB DDR2-800/Windows 7 Home Premium 64-bit

Computer B: (Laptop) Core i7 720qm 1.6GHz Hyperthreaded Quad-Core/4GB DDR3-1333/Windows 8 64-bit

Computer C: (Laptop) Core i3 3217u 1.8GHz Hyperthreaded Dual-Core/6GB DDR3-1600/Windows 8 Pro 64-bit

Which should I choose? I'd run it on all 3 but that's not an option due to others needing to use the machines. I've got one chance, and I could honestly see a case for all 3 of these processors.

thanks!
 
Solution


I'd go with B. Less throttling.

By the way, does option A's RAM really have that much speed? Seems... Off.

elemein

Honorable
Mar 4, 2013
802
0
11,160
What is the algorithm?

All of the CPUs use different architectures with different uses.

For example, lets say your algorithm is:

: a = (b*c)+f

This would take two uops in most CPUs, as it is a multiply and an add. But in the new Haswell architecture, it takes one as they have a fused multiply-add instruction set to accomodate this.

So whats the algorithm?
 

insomniac3334

Distinguished
Jan 12, 2012
58
0
18,630


While I'm not comfortable posting the actual code, it's essentially an exhaustive recursive search encapsulated in a static void that uses backtracking & pruning to reduce repetition. It iterates over each letter in each word and tries each permutation, checking to see:

IF (The permutation has already been tested)
Halt recursion on this particular combination
ELSE IF (the permutation is a prefix OR IF the permutation is both a word AND a prefix)
continue recursing
ELSE IF (the permutation is only a word)
add word to master list, halt recursion on this particular combination


I do not know the "name" of the algorithm, as the professor simply explained the methods and steps we should try to use. The jist of the project is actually the bizarre data structure (a De La Brandais Tree) we're using to store the dictionary object, so the anagram algorithm's implementation wasn't stressed as much.

again, thanks for the help! Sounds like you know your stuff :).


 

insomniac3334

Distinguished
Jan 12, 2012
58
0
18,630


That is what I'm leaning towards as well. It might be the slowest clocked CPU out of the three, but if there's anything I took away from my intro to computer organization class it's ARCHITECTURE, ARCHITECTURE, ARCHITECTURE! Ivy Bridge is the newest and most efficient...
 

insomniac3334

Distinguished
Jan 12, 2012
58
0
18,630


If there's a SIMPLE way to get the JRE to utilize my GTX 670 I'm all ears...

EDIT: Just too clarify the reason I'm not just running this on my 4GHz+ 2500k/GTX-670/16GB RAM build is that it's already booked tonight streaming a hockey game for a bunch of guests, hosting a game server, and being a development machine for the other part of this project.
 


Sorry I just know it can be done. Last time I wrote code was in college 30 years ago. Have no idea how it is done.
 

elemein

Honorable
Mar 4, 2013
802
0
11,160


I'd go with B. Less throttling.

By the way, does option A's RAM really have that much speed? Seems... Off.
 
Solution

insomniac3334

Distinguished
Jan 12, 2012
58
0
18,630


:lol: I meant DDR2-800/PC-6400

My brother's dirty old Dell laptop it is...thanks a lot!
 

elemein

Honorable
Mar 4, 2013
802
0
11,160


Yeah, try it out for a bit. if CPU usaged doesnt hit max temps, then switch to C. There wont be throttling anyways soo..

 

rjackowens

Honorable
Jul 27, 2012
238
0
10,710
From a raw hardware perspective, the CPU in computer A is slightly faster than computer B. The CPU in C is quite a bit slower.


 

insomniac3334

Distinguished
Jan 12, 2012
58
0
18,630
Just an update, I chose the i7 and it completed within only 5 hours. Just swapped in my newly completed tree data structure and it took 5 minutes :pt1cable:

Classic CS. If nothing else, it goes to show how important good coding is, regardless of CPU architecture and speed!