What hardware factors influence program speed?

0

I want a faster laptop for coding (mostly C++ and Python programs) but don't know what factors influence program runtime. Is it mostly CPU speed and RAM? Hyperthreading? Solid state drives?

For example, I like to play on sites like Project Euler, where sometimes I'll need to make a semi-brute force program when I can't figure out a faster algorithm. If I ever have to resort to this, I want the program to be as fast as possible.

DoubleBass

Posted 2013-03-06T21:10:07.680

Reputation: 105

Question was closed 2013-03-07T02:32:35.573

Welcome to Super User! In Super User, and all the StackExchange sites, shopping or product recommendations are considered off topic and open ended, and sometimes even too localized. Try to reword your question in a way that you are not asking for products, but more of processes; this will help keep it on topic – Canadian Luke – 2013-03-06T21:15:06.317

@Luke I just suggested an edit to remove the "what do you recommend" bit. The core of the question (what factors influence speed) is a valid question. – cpast – 2013-03-06T21:20:52.250

I approved the edit – DoubleBass – 2013-03-06T21:22:37.430

@cpast I can't un-vote to close, but now that it's not a hardware recommendation question, as long as 3 other 3K+ users don't VTC, it will go away – Canadian Luke – 2013-03-06T21:41:53.840

Answers

0

It depends a lot on the type of application and what it does, but for Project Euler problems, the speed of execution is largely going to depend on:

  1. How fast your processor runs,
  2. Whether the code (especially the loops) can reside entirely in processor cache, and
  3. Whether the algorithm can be parallelized (i.e. can you solve the problem using multiple processor cores?)

Other types programs may depend on other factors such as hard drive speed and memory speed. Gaming machines lean towards having a better video card than your average, run-of-the-mill one, since games depend heavily on image manipulation.

Robert Harvey

Posted 2013-03-06T21:10:07.680

Reputation: 1 826

Is parallelization something that happens automatically, or is it something you code into the algorithm? – DoubleBass – 2013-03-06T21:27:04.150

It doesn't happen automatically. Most modern programming environments offer something like Tasks or Threads to parallelize computations. Some algorithms lend themselves more readily to parallelization than others. All other things being equal, functional programming languages are more easily parallelizable than imperative ones. – Robert Harvey – 2013-03-06T21:29:17.720

I know it's technically stated in the OP not to ask for hardware recs, but it would really help get me started -- would you recommend looking for something with solid states, fast CPU (what kind?), lots of memory, etc? – DoubleBass – 2013-03-06T21:30:53.193

Unless you're doing advanced scientific number crunching, any off-the-shelf computer with multiple processor cores (which is most of them, nowadays) should suffice. – Robert Harvey – 2013-03-06T21:33:06.827

Many problems do involve heavy number crunching, yes – DoubleBass – 2013-03-06T21:34:40.320

Sure, but not Project Euler problems. If you want me to be more specific, I would need to know something about the nature of the number crunching. – Robert Harvey – 2013-03-06T21:34:59.280

What exactly do you mean when you say "Advanced scientific number crunching" if you do not think PE involves that? – DoubleBass – 2013-03-06T21:36:01.260

Simulating human brain activity, studying protein folding, or rendering a Pixar movie in high-definition. – Robert Harvey – 2013-03-06T21:38:39.513

I'd argue that it'd be nice to be able to have that kind of crunching power – DoubleBass – 2013-03-06T21:39:53.970

Let me know when you win the lottery. :) – Robert Harvey – 2013-03-06T21:42:23.523

I mean the reason for my responses here is that you stated "Any off-the-shelf computer will do" but to me this sounds like "anything goes" when in reality some computers will definitely outpace each other. I am just trying to lock in on what computer will be among the fastest. – DoubleBass – 2013-03-06T21:45:02.007

In general, the one that you spend the most money on will be the fastest. The problem is, as you go up the price/performance curve, it gets steeper, so your overall value decreases. What you want to do is hit the price/performance sweet spot; I suspect that, right now, you can probably spend about $1200 and get a very nice computer that is more than adequate for your needs. – Robert Harvey – 2013-03-06T21:46:30.253

I'll keep that all in mind; thanks for all the advice! – DoubleBass – 2013-03-06T21:56:38.760