Ars Technica had a great post this week about the differences between compiled and interpreted code, and why some computer languages are faster than others.
If you’ve ever wondered how a compiler works, or why someone might choose C++ for a project rather than Python this is a great read.
This compilation process has several steps. The source code is analyzed and parsed. Basic coding mistakes such as typos and spelling errors can be detected at this point. The parsed code is used to generate an in-memory representation, which too can be used to detect mistakes—this time, semantic mistakes, such as calling functions that don’t exist, or trying to perform arithmetic operations on strings of text.
This in-memory representation is then used to drive a code generator, the part that produces executable code. Code optimization, to improve the performance of the generated code, is performed at various times within this process: high-level optimizations can be performed on the code representation, and lower-level optimizations are used on the output of the code generator.
I’m not a programmer (not mostly, anyway) but this definition makes sense to me. Essentially, compiling code in advance saves time so that the program runs faster later.
What is interesting to me is that the human brain functions very similarly. We are hard-wired to interpret and react to certain types of information much faster than others. In particular, we interpret images and sounds faster and react more emotionally to them than to textual data. These types of information are processed by different hemispheres of the brain.1
“In a real sense, we each have two brains,” writes Dr. Martin L. Rossman. “One thinks as we are accustomed to thinking, with words and logic. The other, however, thinks in terms of images and feelings.”
One of the chief difference between right-brained (emotion, imagery, sound) and left-brained (text, logic, mathematical computation) information processes is their speed; the human brain processes and reacts to right-brain information types almost immediately, while left-brain information requires sequential processing. Think about how long it took to read this article. Then think about long you spent looking at the brain illustration graphic. Although you almost certainly spent longer reading the text than looking at the illustration, when measured in bytes, the illustration contains 97.75 times as much information as the text. (That’s 4KB vs. 391KB.)
If you think the analogy above is far-fetched, think about traffic signs. Why do the most important road signs and signals use colors, shapes, and symbols in place of or in addition to words? In large part, it’s because drivers react more quickly to pictures than to words, and that extra second or two might save somebody’s life.
This makes sense from an evolutionary standpoint — if you see a snake moving through the grass, you need to be able to jump back. If you hear an infant wail in distress, that sound had better be the most piercing and unpleasant thing you could possibly imagine. Written language wasn’t even invented as a technology until about 5,000 years ago (mathematics even more recently) so it kind of has to take a back seat to the survival traits that got our ancestors through life as hunter-gatherers.
Today, the bulk of human communications do not happen by accident. Instead, they are mediated, organized, and planned by the industries we know as marketing, propaganda, advertising — and of course, design. Appeals to the right brain can be powerful and subtle. Because citizens are not trained to evaluate or analyze right-brain “coding techniques,” these techniques lend themselves to manipulation and abuse by hidden persuaders — usually those with power and money.
But no technology is good or bad — it’s all in how we use them. Images, sounds, video and other “pre-compiled” right-brained media are incredibly effective at communicating information quickly and reaching people on an emotional, gut level. Just as one might choose node.js for one project, or C++ for another, images, video, and sound are not the best technology for every situation or to convey every type of information, but they are a powerful tool in the hands of those who have the skill and awareness to wield them.
1 http://www.nobelprize.org/educational/medicine/split-brain/background.html
Nodejs is interesting because it uses v8 (javascript engine from google chrome).
v8 is actually a very *very* fast compiler, and also a slightly slower compiler…
v8 compiles the javascript code into native binary as fast as it possibly can
but that binary is kind of stupid and it’s slower than it has to be. So it
watches that code run and then makes optimizations to the original and compiles
it again, swapping the original binary for the slower-to-compile faster-to-run
binary while it’s running.
The brain sort of does the same thing. An illiterate person sees words as these
symbols on paper and doesn’t understand them. Over time they become able to look
them up in a sort of lookup-table in their mind but then at some point the mind
rewires itself into a very fast compiler, like v8… Then they can read words
and immediately connect them to the relevant mental processes.
There is another thing which a compiler does which was ultra critical to the
original success of the C language and very important to your discussion, it
writes machine code for many different types of processor. In the 70’s, the
concept of Open Source just didn’t exist because all code was written in native
machine code and porting a program from one type of computer to another (or
even from one actual machine to another!) was a massive undertaking, often the
program would just be rewritten from scratch. Today cjdns runs on x86, amd64,
mipso32, ARMv7 and PowerPC because the GCC compiler can output all of these
(wildly different) binary languages.
Similarly, language gives us a common way to represent ideas which if
represented pictorially, would be different for each brain. Road signs are a
fitting example of pictograms because the road signs “tell you what to do”,
and while design can “tell you what to think” it is not able to represent
complex concepts which are needed to empower a person to make their own
informed decisions. Code is even more standardized than language and can
express even more advanced concepts…