blockfreq, C++, Lua and random thoughts

I'm still hopping programming langauges. Cool that after so much hacking there are still new ones that are actually important to learn.

Juho is very gently introducing me to C++ a la Google. I admit I'm taking it up very slowly, but it seems inoffensive enough. I'm going back on my Erlang-hackerish resolution that "life is too short to learn C++". It'll be interesting to see how this experiment progresses.

Lua is what I'm learning for fun now. I've picked it because my programming has been getting more and more low-level lately, so that it ends up being mostly C, and I need something for the "non-mostly" bits. I'd like to be able to quickly prototype code and then incrementally port most of it to C. I tried SBCL for this for a while, but I never really loved the FFI, and I found that in the end code would have to become 100% C because the runtime system is too heavy to keep around. So I'd like something that's pleasant to prototype with, plays nicely with C, and has few enough moving parts that it can come along for the ride into production. Hopefully Lua works.. otherwise I really need to get good at C++.

So today I wrote my first random Lua program, called blockfreq. I'd be mighty obliged for any tips on how to write it better.

Incidentally the coolest hack we've done recently was to write an inline device driver for the Intel 82599 10Gbps networking chip. This contributed quite a bit towards a doubling in the speed of our already-pretty-optimized networking application at work. Intel did a good job on these chips: the hardware is nicer to integrate with than most software. We really benefited from dragging the DMA engine up to the application level. Quite a bit neater than some past escapades in device driver hacking. (Including the Intel HD Audio chip that was surely designed to annoy firmware hackers who're trying not to use interrupts.)

Randomly, I also discovered that Intel have a nice and simple profiler for bandwidth utilization on system memory and the QPI links that interconnect CPUs and PCIe. This actually makes it simple and easy to understand NUMA efficiency. Cool. There's really no need for this stuff to be a black art.

Last-randomly, I've gotten bored of Twitter and Google+ and nuked those accounts. Trying LJ again. Where are all the cool hacker-kids nowadays?

ZSLUG #1: Zurich's new Lisp & Stuff User Group

Title:Zurich Lisp & Stuff User Group (ZSLUG) rebirth!
Date:Monday February 7th, 2011
Time:7pm onwards
Venue:Office of Teclo Networks AG, Alfred-Escher-Strasse 27, 8002 Zurich.
Map:Google Map
Directions:Train to Enge and then walk one block.
Speaker #1:Hans Hübner on Creating computers from (almost) scratch using FPGAs, VHDL and Forth.
Speaker #2:To be announced.
Then:Wander off for food drink and conversation somewhere nearby.

Interested in Lisp and Zurich? You're in luck! The first meeting of the reborn Zurich Lisp & Stuff User Group (ZSLUG) is just for you. Luke Gorrie and Ties Stuij have taken it upon ourselves to revive this meeting as part of our broad new effort to put Zurich onto the Euro-Lisp map.

ZSLUG is above all else a Common Lisp meeting. We're aiming for a 50/50 mixture of Common Lisp with other delicacies such as Smalltalk, Forth, Erlang, VHDL, R, Scheme, and anything else that's likely to delight the Lisper palate.

We're excited to already have confirmed prominent Common Lisp hacker Hans Hübner as speaker, and we expect to announce a second speaker before the meeting. Follow us on @zlisp if you want to keep up-to-the-minute!

Everybody is welcome at ZSLUG. The meeting will be very informal and you can be as social as you want to be. The default language is English and no registration is required, but a tweet to @zlisp to let us know you're coming would be greatly appreciated!

Historical Note: ZSLUG is our rebirth of the Zurich Scheme & Lisp User Group created by Jose A. Ortega Ruiz who has since moved on from Zurich. We switched from Scheme to Stuff -- sorry, we're not Schemers!

Teclo Networks, and, Happy new year

What a year. I'm finishing 2010 the same way I started it: living in my favourite place in the world, Zurich. (Here's a hint why.) True to form I did spend almost every single day of the year traveling somewhere else, but hey that's a hard habit to kick.

My illustrious friends and my humble self invested this year in starting Teclo Networks. Teclo is the latest in a series of successful high-tech startups all using the same tried-and-true formula: great people, great technology, great products. This time it's Common Lisp and 3G/4G mobile internet infrastructure. It's an exciting new adventure :-)

You'll be hearing more from us over 2011, and we'll be working to put Zurich on the EuroLisp map. I hope to see you at the Zurich Lisp Meeting, coming soon..

Meanwhile: Merry Christmas and Happy New Year :-)

P.S. Teclo -- it's telco with CL.


EUC 2009

The Erlang User Conference in Stockholm was a lot of fun! Thank you everybody at Erlang Training and Consulting for the excellent organisation.

My favourite talk of the day was Patrik Nyblom on the development of SMP support in the BEAM virtual machine. He was entertaining andalso inspiring: that is some really hot technology that our programs are sitting on. I'm reminded of Klacke's talk in London last year: Erlang programmers do have a more powerful tool than everybody else and now is the time to make the most of it.

Kostis Sagonas's presentation of the latest Dialyzer developments was great too. I'm one of those opinionated bastards who doesn't care much about standardized programming styles and this tends to put me at odds with people writing linting tools. This time I had no room to complain: the tool is entirely optional, the motivating examples of bugs it can find were very easy to relate to, and it's been developed and maintained as a production tool for many years now. Great marketing!

Some of the other talks really lacked motivating examples for me. I'm sure it's fun to write cloud-hosted databases and map-reduce frameworks, but what problem does it solve for me? The SQL people have long since fallen into the trap of "if all you have is a hammer, everything looks like a nail." NoSQL might be the same.

I dined a bit too well with friends on the nights leading up to the conference and so I missed the first talks about Nitrogen and advanced parse-transform hackery, which is a pity because I heard they were some of the best.

The whole week in Stockholm has been a really great time. I'm writing this on my short flight back to Switzerland at the moment and feeling very glad to live in the neighbourhood again. Now back to Erlang hacking..

ECLM 2009

I had an excellent time at ECLM. It's always my favourite conference - diverse hackers, two dinners to one day of talks, great atmosphere. I'd like to have seen more faces - Christophe Rhodes, Tim Daly, Tony Martinez, Marc Battyani to name a few - but you can't have everybody. Thanks a million Edi & Arthur for making this happen, and see you in Amsterdam for ECLM 2010 :-)

My favourite was Dimitri Simon's delightful talk about Piano. He's spent his career writing a program that's great for aeroplane engineers like himself, he developed it using a program that he loves (MCL), and it's maintained with help from the many nice people in the room (Clozure, Edi, Lispworks). He's a one-man company and his licenses start at £50,000. What's not to smile about?

Paul Tarvydas and David McClain each gave forceful talks with a "this is how real engineering is done" flavour, but I wasn't entirely convinced. Do you really need a Lisp-based clone of Erlang with homebrew cryptography to admin routers and farm out calculations? Or a visual digital circuit design environment to mail-merge commercial brochures? They seemed like brilliant and accomplished people with too much opportunity to over-engineer their programs.

Dan Weinreb's talk was an enjoyable taste of Lisp programming in the large. The impression I got was that things are going quite well and their system is coming together nicely. One later reflection though: whereas Lisp was a famous win for their fare search engine, it seemed like more of a mixed bag for their Oracle-Lisp-Java reservation system. I feel for them being unable to separately compile their source files, for example. I look forward to future reports.

I made a four-minute lightning presentation about Openfirmware. I had three things to say: if you want to experiment with low-level programming on a well-engineered self-contained platform, it's easy with Openfirmware on OLPC. If you want to port your Lisp system (or other program) onto a platform that's free of the C/POSIX/Unix legacy, Openfirmware is easy for that too - the only primitive you need is to call Forth's APPLY and then all the drivers are yours. And if you have an operating system of your own (like Movitz) and you want some cheap device drivers, you can write an IEEE 1275 Openfirmware FCODE interpreter and reuse a whole stack of portable ones from Openfirmware. (And if you don't care about any of those things, well, four minutes isn't a very long time.)

Europe, Switzerland, OLPC, Boston, Canada, etc

I've been busy: briefly catching up with lots of friends around Europe, clearing Swiss immigration, exploring Switzerland by bike and by foot, working with Mitch on the OLPC-1.5 rev-A2/B1 firmware, meeting interesting people in Boston, going to a great wedding in Canada, and so on.

The highlight has been a quick cycle tour from near Zürich (Pfäffikon) through Davos and Flüela Pass to Vulpera near the Austrian/Italian borders. Hiked some beautiful mountains, picked lots of wild berries, and got introduced to Kaiserschmarrn at a friendly alp.

I'm extremely happy with my new touring setup: a Specialized road bike, a Deuter Superbike backpack, a waterproof sleeping bag from REI ("just add forest" one-piece camping kit), and bugger all else. France, Germany, Austria, Italy: I'll ride to you soon :-)

Current agenda: ECLM on the weekend and then finding a more permanent home than Juho's couch in Zürich.

Code snippet of the day

A Forth assembler word that happened to cross my path today:
code expand-rect  ( src dst w h --- )
   dx  pop              \ Height of source image in pixels
   4 [sp] edi xchg
   8 [sp] esi xchg
      0 [sp]  cx mov   \ Width of source image in pixels
         op: ax lods                \ Get a pixel
         op: ax d# 2400 [edi] mov   \ Write to next line
         op: ax stos                \ Write to this line + increment
         op: ax d# 2400 [edi] mov   \ Write to next line
         op: ax stos                \ Write to this line + increment
      d# 2400 # edi add             \ Skip the next output line - already written
      edx dec
   0= until
   eax pop   \ Discard source width
   edi pop   \ Restore EDI
   esi pop   \ Restore ESI

Posted just 'cause it's nice to have a little asm in life.