Monday, December 27, 2010

A Comic Interlude

(While I work up courage and energy to write about other things)

The comic strip Frazz offers insightful and witty takes on (American) school life. Its calligraphic style and appearance of the eponymous character has fueled speculation that Frazz's creator Jef Mallett is actually Bill Watterson. Wikipedia seems to believe otherwise but hey, it is fun to speculate :P

Christmas day's Frazz comic offers a nod and wink to Calvin and Hobbes. Those who have enjoyed Calvin's early Christmas morning sorties to check for presents (and wake up his parents at ungodly hours) should get the reference easily enough.

Frazz (Dec 25, 2010)

Calvin and Hobbes (Dec 25, 199?)

I am not surprised - Jeff Mallett has acknowledged Watterson's influence and this is not the first time he has tipped his hat at Watterson.

In case you didn't know already, you can read both Frazz and Calvin and Hobbes online.

Friday, September 10, 2010

Re: Why Django Sucks

I recently came across this presentation on 'Why Django Sucks' and the associated discussion in Hacker News.

One of the key points raised was the perceived insularity of Django's core development community. In this context I have an anecdote to share about the core community or rather how the core community is frequently sloppy with the triage process.

I reported a Django bug and more importantly submitted tests for it. The bug languished for a while and eventually got fixed as a side effect of some changes. I reported this when I found out and a month later someone closed it. The regression tests, however, never made it to the test suite.

I believe that (1) people who take their time to give you a test are doing you a favor (2) one should never miss a chance to add a valid regression test to the suite.

I don't think there was any malice or hubris but the closed nature of the community did have something to do with this. I suspect that how fast and how thoroughly a bug is accepted and processed depends on who submits it. This will prove unhealthy in the long run.

So what can be done to address this? I believe that the bug triage process will benefit from more eyes. These don't have to be those of core developers but of people with the authority to take decisions on bugs. The community should also actively encourage people to submit more tests. Spread the word that this is as important as submitting patches.

Thursday, July 08, 2010

Setting up a color scheme for Emacs

I am an Emacs newbie. I found a nice color theme for Emacs and wanted to set it as default. Following the instructions from the color-scheme homepage did not work. After some searching I found out a way to make it work.

I installed emacs-goodies-el using apt-get and put the following in my $HOME/.emacs.el file:

I am reproducing this here in the hope that someone else will find it useful. I am running Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.16.1) of 2010-03-26 on palmer, modified by Ubuntu on Ubuntu Jaunty.

Friday, June 25, 2010

Indian Software quote of the day

A friend was asked to translate the following sentence to another language. The author was an "experienced senior software engineer" in a large Indian software services company.

"We were bit used to use remote desktop, but I will do the necessary actions to check this option and shift the full activity independent for the remote option."

Monday, March 08, 2010

Reading Notes #3: Ring Benchmark

I have been working my way through Joe Armstrong's Programming in Erlang. One of the exercises in chapter 8 is to write a "ring benchmark" in Erlang and any other language, compare the results and publish them.

Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times so that a total of N * M messages get sent. Time how long this takes for different values of N and M. Write a similar program in some other programming language you are familiar with. Compare the results. Write a blog, and publish the results on the Internet!

Here are my benchmarks written in Erlang and Python respectively. I have presumed that the author meant sending messages synchronously; i.e. a message has to go around the whole ring before the next can be sent.

The Erlang version was easy to write. After all the language is designed to use a processes and messages paradigm of programming. Here is the source code:

I wrote the "other programming language" version in Python. The benchmark code makes use of Python's multiprocessing module (available in version 2.6 and above). Since I couldn't find any Erlang-style way to directly send a message to a process I chose to use a set of Queue objects to accomplish message passing. Each process has access to two queues - an "in" queue to receive messages and an "out" queue to relay them to the next process in the ring. Each process' "out" queue serves as the "in" for the next. After constructing N - 1 processes, a "plug" process is created to complete the process ring.

I am not entirely convinced that Python's processes are the equivalent of Erlang ones. Certainly threads are not the answer given their use of shared memory. Perhaps the difficulty in creating lightweight, shared-nothing processes in other languages is what the author wanted to illustrate using the example.

The results are shown below. The program was executed on a machine with a dual core Pentium, 2GB memory and running Ubuntu Jaunty.

Please note that:
  • I could not increase the number of Python processes to the order of 1000 (10^3). When I tried to do this the program crashed with a number of errors.
  • I got a curious QueueFeederThread exception when I executed the process for N = 100, M = 10000.

N M N * M (Wall) Time in seconds
Erlang Python
10 10 10^2 0.0 0.0732
10 100 10^3 0.003 0.1795
100 100 10^4 0.036 2.3976
100 1000 10^5 0.242 12.2252
1000 1000 10^6 1.877 -
1000 10000 10^7 18.593 -
10000 10000 10^8 197.477 -