Hot answers tagged

47

Theoretically yes, but practically it's rarely worth it. Both CPUs and GPUs are turing-complete, so any algorithm which can be calculated by one can also be calculated by the other. The question is how fast and how convenient. While the GPU excels at doing the same simple calculations on many data-points of a large dataset, the CPU is better at more ...


28

It is not related to game programming. Some scientific code can also use both the GPU and the CPU. With careful -and painful- programming, e.g. by using OpenCL or CUDA, you could load both your GPU and your CPU near 100%. Very probably you'll need to write different pieces of code for the GPU (so called "kernel" code) and for the CPU, and some boring glue ...


9

From a supercomputing viewpoint it is better not to think in CPU/GPU load in percentage but rather determine how many operations your problem at hand needs and then compare that to the peak performance of the system. If you get 100% CPU utilization it does not necessarily mean that you get all the performance out of the system. CPUs can often do multiple ...


4

Wow. Function calls are slower than string searches? What implementation of Java are you using? I used to write assembly, and the manual would tell how many "clicks" each instruction took on the processor. Those days are gone, but if I had to guess how many clicks various operations take, I'd guess something like the following: bitwise operations: 1 ...


3

If they have competitors, then performance is a major criterion by which they are judged. By the way, if you think performance is a matter of using switch vs. if, you're missing the point by an enormous margin. You don't know what to fix in the code until you find out what takes time. That can seldom (i.e. never) be done by eyeballing the code. What I do ...


3

For a single simple method, using a stopwatch can work well. For larger, more intricate code, though, what you want is a profiler, an external tool that attaches to your program as a debugger, lets you run it, and monitors how long the code that you're executing takes and where the time is being spent. When you're finished, it gives you a statistical ...


2

You could read the available folder names just once, and store their names in a local file. When the macro is run again, read that file into memory and use it to find the full folder name for a given project number quickly. Once you know the full name and folder path, navigating to the folder object should be easy (see here for a generic solution, utilizing ...


2

The database can only hold 1 write concurrently and does not support transactions. If this value is exceeded, the database responds immediately with an error code XXXXX. This is extremely bizarre for any modern database, but let's accept the premise. At a high-level, there are 2 approaches to concurrent data modifications: Pessimistic - This is lock-...


2

Reading the specs, the main point of your requirement is: An user should receive an immediate response that vote was accepted. To achieve that, you could separate out the vote-taking-part. Each of your two instances need to talk to a component responsible for that. Then the problem arises, this component becoming the bottleneck in your architecture. ...


1

You might be interested in checking out the Servo browser engine being developed at Mozilla Research, and more specifically its Web Render (video). While shifting a task from CPU to GPU dynamically might be impractical, as mentioned in other answers (notably @Philip's), it can be practical to study the load of CPU/GPU on typical workloads in advance and ...


1

Embedded development. When you're working with a tiny memory footprint and real time requirements you have to constantly be thinking about every aspect of performance, both speed and memory. Real time embedded devices often require response times in the order of milliseconds in my experience. If a routine is off running for 10 seconds somewhere, you've ...


1

Projects that have performance requirements. It really doesn't matter what the hardware is. I can drive anything to 100% utilization. Same as I can fill any hard drive. The question is, can I ignore performance and still hit my performance goals. If yes, I am justified in ignoring performance. Some projects find they have performance problems. If they ...


1

A few tips. Local variables are declare local and initializated to null if strings or 0 if number if you develop in bash use bash. (+=, for arg;do done;...) Use always builtin [[ notnumber ]] or (( number )) never [,test,( or any other function() { local runCommand= local -i index=0 #you don't need the extra parameters here for strings; do ...



Only top voted, non community-wiki answers of a minimum length are eligible