The world needs lean code!


Efficient code is green code, code that will work better on old or “light” computers used in developing countries, better on the shiny new netbooks (such as the EEE) that are coming out these days – and that will make a fast computer even faster. Efficient code, it seems, has no downside.

Jim Gettys  of OLPC says in a July 2006 interview:

There seems to be a common fallacy among programmers that using memory is good: on current hardware it is often much faster to recompute values than to have to reference memory to get a precomputed value. A full cache miss can be hundreds of cycles, and hundreds of times the power consumption of an instruction that hits in the first level cache. Making things smaller almost always makes them faster (and lower power). Similarly, it can be much faster to redraw an area of the screen than to copy a saved image from RAM to a screen buffer. Many programmer’s presumptions are now completely incorrect and we need to reeducate ourselves…

A large part of this task is raising people’s consciousness that we’ve become very sloppy on memory usage, and often there is low hanging fruit making things use less memory (and execute faster and use less power as a result). Sometimes it is poor design of memory usage, and sometimes it is out and out bugs leaking memory. On our class of a system, leaks are of really serious concern: we don’t want to be paging to our limited size flash.

In fact, much of the performance unpredictability of today’s free desktop can be attributed to the fact that several of our major applications are wasting/leaking memory and driving even systems with half a gigabyte of memory or more to paging quite quickly…

X [the X window manager] does what its told: many applications seem to think that storing pixmaps in the X server (and often forgetting about them entirely) is a good strategy, whereas retransmitting or repainting the pixmap may be both faster and use less memory. Once in a while there is a memory leak in X (generally in the graphics drivers): but almost always the problem are leaks in applications, which often forget the pixmaps they were using.RAM in the X server is just as much RAM of your program, though it is in a different address space. People forget that the X Window System was developed on systems with 2 meg of RAM, and works today on 16 megabyte iPAQ handhelds.

We need better tools; some are beginning to appear. OLPC is sponsoring a Google Summer of Code student, Eduardo Silva, from Chile, who is working on a new tool called Memphis to help with this problem.

Work done on memory consumption will benefit everyone: not everyone in the world has a 2ghz laptop with a gig or two of RAM…

Nuff said.

Confession: I’m not a coder. I help with the development of Linux only by documenting the parts I know, and by reporting bugs. While I join Jim Getty in calling for more efficient code, even much of the bloated code still represents an enormous amount of good work – it just needs some cleaning up to become awesome code.

For the unconnected

A question at BarCampAfrica: What use is a wiki, for the poor who have no internet?

  1. First you need to develop the information the resource. But over time I’m sure the Appropedia community will put more and more effort into dissemination.
  2. There are all kinds of ways of distributing offline content – in a computer (e.g. OLPC bundles), CD-ROM flash drives,  hard drives, printouts (leaflets, booklets or books*), education programs based on content developed on the wiki.
  3. Phones. A story was told at BarCampAfrica of a conversation in Africa. “Have you heard of Google?” “Yes, of course.” “Have you searched Google from a mobile phone?” “Of course – how else can you search with Google?” You only need one phone in the village with this capability to massively increase people’s ability to find information.
  4. Villagers who have moved to the city to work, that maintain a connection to the village – if they have internet access, they can send or take the information back to the village.
  5. That other way – the one none of us have thought of yet.

There’s no need to put weighting on the different channels. You might think #4 won’t be effective, for example. You may be right. For now, the important part is #1: Create the resource.

* This is one reason that it’s so important to use an open license that allows commercial use, so people can be motivated distribute this knowledge.

Subsidies hurting Africa

BarCampAfrica – The OLPC (laptop) project is another form of harmful subsidy, says one critic. It was a gentle critique – even the critic is a fan of the OLPC project in many ways (as am I – extremely cool tech and great educational ideas).

But it’s clear to anyone familiar with development issues that subsidies really are harmful, much of the time – and the speaker had examples of his own. Like the big headaches for ISPs in Africa when international aid organizations come in and dropping free connections on schools or communities. Such subsidies take out a whole chunk of the market that businesses no longer have access to – then when the aid organization leaves and goes somewhere else, the locals are left with local businesses that are weakened and less able to serve the community.

Now, I still see the OLPC as doing much more good than harm. Sure, they’re taking out a huge chunk of the market… but that market mostly didn’t exist before OLPC’s innovations made it possible to serve these people.

So, I like the suggestions: Open source the design*, let anyone build them, and keep the margin local.

On the other hand, I wonder if there is any possibility of a market-based solution that achieves OLPC’s aims, especially saturation. But if a no-subsidy model leads to more effective markets and institutions, then that may be a more important achievement. It also leaves space for more innovation – e.g. variations on the Educational Television Computer (a.k.a. the $10 computer).

* Actually, isn’t it already open source…? Help me out here...

As with all posts in this blog, the views expressed here are those of the poster, and don’t necessarily represent the Appropedia community.

Cool little laptop – the OLPC Australia TechFest

I played with the XO (a.k.a. $100 laptop) at the OLPC Australia TechFest.

The XO is a very cool machine. Looks perfect for kids, regardless of whether they’ve used a computer before. I’d heard about it before, and tinkered for a few minutes in the past. But actually trying out the latest laptops, seeing the quality of the machine and the video display, and using the various programs for art, music and and science, it was something else. The way the Sugar interface works is ideal for exploratory learning, and the way the the mesh network together with Sugar facilitates group activities is really impressive.

Chatting to the OLPC people about the Windows controversy was encouraging too, to get the inside story rather than just media reports. The clear message I’ve heard is that they are definitely supporting open source, whatever public speculation is happening, and whatever else people want to do with the machines.

One thing said during the day made me laugh:

Senator Kate Lundy took an XO to a Labor Party meeting. (Prime Minister) Kevin Rudd liked it. We know, because the XO took a photograph of his smile.

(Sounds like the first wave of an alien invasion, reporting back to headquarters.)

Sarah Maddox has more.

At Appropedia we’re thinking about how we support the OLPC with free content, and about the Summer of Content, which is still a possibility for this year with a bit of work in the text 2 weeks. More on that shortly. Edit: This didn’t eventuate this time around, unfortunately – too much to do and we didn’t have the people to carry it all the way. But it’s looking definite for the Southern Summer (December 08 – February 09) in conjunction with OLPC Australia, their partners, and whoever else wants to support the work.

Originally posted, by the same author, at Pablo Garuda.