4 ms·
And yet the most efficient programs are written in the low level languages, and the slowest programs are written in high level languages where optimization is t
by gizmo 9y ago
And yet the most efficient programs are written in the low level languages, and the slowest programs are written in high level languages where optimization is the responsibility of the compiler.
Compilers can definitely do better than humans in some situations, but you can also use an optimizing assembler that helps with register allocation (not as important for x64) and all sorts of peephole optimizations. The compiler doesn't reason about the data, which means the compiler has to make worst-case assumptions that the programmer knows won't occur. This is a big source of inefficiency. Compilers will never be able to make strategic optimizations because the compiler doesn't understand what it's compiling.
Like with chess, computer + human is the winning combination.
- tyingq 9y ago"Like with chess, computer + human is the winning combination." Curious what you mean here. My layman's observation is that computers have far surpassed humans in that space.
- Retric 9y agoNot starting from scratch. Modern chess programs leverage a lot of human design and analysis work.
- MiddleEndian 9y agoHe's probably referring to Centaur Chess, where a team of a human assisted by a chess computer (or perhaps more accurately a computer assisted by a human) competes against another similar team. https://en.wikipedia.org/wiki/Advanced_Chess https://en.wikipedia.org/wiki/Advanced_Chess
- Santosh83 9y agoThey're probably saying that a human assisted by a chess program (during training, not during actual game) can on average do better than a human who has practised chess without any artificial analysis/help. They could also perhaps mean that a chess program that takes human input during processing can do better (on average) than one that doesn't. Essentially they imply human + AI is superior to either of them in isolation.
- betterunix2 9y agoI am not sure how you are defining the "compiler" here; the compiler back end that emits code is where register allocation and peephole optimizations happen. "The compiler doesn't reason about the data" It certainly can; it is hard in a language like C due to the deficiencies of the type system, but in other languages the programmer can more explicitly state constraints on values. Compilers can also make useful inferences about constraints based on e.g. conditional statements, loop bounds, etc. Where humans win is in designing more efficient algorithms. Compilers are great at reducing the constants but still cannot improve the asymptotics. In other words, human effort is better spent on the higher-level concerns, and yes, some languages are better than others for that task. "Like with chess, computer + human is the winning combination." Chess-playing programs are so much better than humans that it is not even interesting to compare them anymore.
- davemp 9y agoAre you trying to make the “sufficiently smart compiler” argument here? The reality is that the fastest compilers for the fastest languages still require babysitting and hand written ASM for peak performance. > human effort is better spent on the higher-level concerns For most cases, yes I (and likely most people) agree. Although there are times when we do care and it is important to know that our tools are not infallible.