Code = f(English)

From a philosophical standpoint, I feel like the crux of programming for performance is mapping concrete expressions of logic to a performant implementation. Programming languages are inherently very rigid expressions, yet compilers find a way to interpret the same expressions into a multitude of implementations. Intuitively the more ambiguous/more high level the expression of logic is, the more room the compiler has to optimize. For example, a loop may be unrolled from:
for (int i=0; i<3; ++i) { do_something(i); } 
do_something(0); do_something(1); do_something(2); 
If do_something() is an independent operation, we may distribute them onto separate cores for ideally a 3x performance gain.

In theory, the highest level expression of logic would be English, going down we'd have Python/Ruby, C, and so on. However, there's a HUGE jump between Python and English. English is ambiguous, Python is not. To make that jump, you'd have to have some means of inferring. Siri/Google Now seem to take a bottom up approach where they map specific expressions to specific implementations. This makes sense since the phone only has so many things it was intended to do.

But I wonder if there's any work being done such that we can "program" computers on the fly using English that is more than a 1:1 mapping from word to action. Very few people write assembly for a multitude of reasons, one of them being, it's hard to out-optimize a compiler. That makes me wonder if compilers would be so good with English that no one wrote C anymore by virtue of the fact that a compiler has a large amount of freedom to optimize.


Popular Posts