Skip to main content

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); } 
to:
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.

Comments

Popular posts from this blog

How to get 70 job interviews in 17 days

When I was but a wee lad, I dreamed of being a janitor for NASA. There's just something awesome about playing a part, no matter how small, of something that dares to push the world forward. While I no longer hold my old lofty dreams of working for NASA, I have had to recently look for jobs. For whatever contrived reason, the conventional thinking behind how people should search for jobs falls under two categories: networking and job sites. While those approaches work, a very useful metaphor for how you might view yourself is that you're a business. You sell your product (your time) for a salary (your revenue). You might argue, most wages in the western world are $20,000 USD to $500,000 USD. If you're a business, then it's probably also helpful to think about selling your product (time) like a business. Typically, different price points in business dictate different sales and marketing techniques. Below say, $10 a month, direct sales (sales where you sell to people on …

Differences and similarities in web servers

If you talked to a new grad and asked them "how can I achieve concurrency in code?" There are two obvious answers: multi-threading and multi-processing. Factually, both approaches are schemes to map instructions to the CPU/bare metal. Although from the hardware's standpoint, they are very different, from an engineer's standpoint, many use cases tend to be fairly similar. This matters for web servers.

In fact, for a long time, those two methods (multi-processing and multi-threading) were the primary ways to map HTTP requests to a web server's hardware. That is, if a request comes in, a request will map to a process or map to a thread. In Apache HTTPD-speak, you can control which scheme you use. That mapping component is called the "Multi-Processing Module" or MPM. This is all fine and dandy if the requests don't do anything requiring blocking or asynchronous behavior and all requests are short lived. However, nearly all modern web applications requir…

What marketing might look like in the future

There once lived a wise, middle aged, bald prophet named Marc Andreessen. His job, was to profit from prophecy. Today, he is one of the most well known, and respected, venture capitalists in the world. He is famous for some of his sayings such as "if you want to see where a bubble is forming, follow the MBAs" in reference to the MBAs going to Wall St during the mortgage backed securities crisis of 2008 and the dot com bust in 2002. Arguably, his most famous saying is/was "software is eating the world". Today, it's a foregone conclusion that, software has broken the way a lot of industries fundamentally operate. I think it's particularly interesting, however, to think about what that means for marketing. I'm of the opinion that, very few companies really understand what they're doing and that modern marketing should not only look like engineering... it should be engineering.

One way to think about marketing is that there are two key components to mar…