Since image processing is both trendy and a good candidate for parallel optimizations, I took the time to implement a little program that compute a part of the Mandelbrot set (a well known fractal) in a fancy way :
Now for the facts & numbers :
Sequential generation : 26.5s
Parallel generation : 13.7s
Effective speedup : 2 times faster (dual core computer)
# changes between sequential and parallel : 3 lines
Oh, and this was done using the ParallelFx bundled with Mono 2.6 that you can already use today in your applications.
More informations and tips on Sunday 7th @ FOSDEM in Mono room. Don’t miss it !
PS: Also, don’t forget Mono Hackaday on Monday February 8th.
So if you weren’t aware of it yet, Mono is going to have its own dedicated room at FOSDEM. In order to spread Mono awesomeness, submit talks here before the 20th. You can even decide yourself how much time you are going to use so don’t hesitate to speak about a cool software you are working on, a nice hack you have done or a how-to on a library for instance.
Mono Hackaday
As a side event, there will also be a Mono Hackaday the day after FOSDEM, i.e. Monday 8th, at Hacker Space Brussels (HSB) with all the vital hacker facilities (location details here). Everyone is welcome to drop by from 10am to 19pm. There is no precise goal for the hackaday, it’s just enjoying your normal and random hacking with other Mono fellows.
As of Linux kernel 2.6.31 (currently available on Arch Linux for instance), due to a change in the iwl* drivers, the sysfs entries that were managing power saving on related WiFi chips was removed due to some power management-related bugs.
As such, it’s impossible to manually set powersaving either using sysfs or via a command like iwconfig power.
Worst part is that the drivers aren’t even correctly advertising themselves to mac80211 (the underlying layer of the WiFi stack) as able to handle power saving operations thus preventing any event to be propagated back to the driver. You can find more information about the problem on the following thread.
Of course this sucks quite a bit for people who cares about their battery life and who don’t want to wait for 2.6.32 kernel. That’s why we decided to try up compat-wireless.
Compat-wireless is a set of scripts that allows you to install the freshest drivers from the linux-wireless project (list of driver here) in a safe fashion i.e. without messing up your distribution supplied modules and without need for a kernel recompilation. These new modules are also very easy to uninstall and everything is made to prevent you from nuking too much your system.
Turns out that in recent revision of the drivers (>= 2009-10-28), powersave is back in a sort of automated fashion and blocking powersave operations are now limited to the faulty driver/chipset : iwl4965. So if you either use iwlagn or iwl3945 (lsmod will tell you) chances are good that you will get back your nice powertop output (it did for a friend and I).
As for installing the beast, the instructions on the official website starting from here are simple and straightforward.
Of course, if you were using iwl4965 your are still left out. However, if power saving weren’t breaking up your driver on earlier kernel version, you can simply comment out the .broken_powersave = true configuration statement in iwl-4965.c (line 2282 or so) under drivers/net/wireless/iwlwifi/.
If you are using Wicd and usually stare at Banshee trying to download cover art or post to last.fm while you are disconnected, the following patch add just the support to fix this.
Here is the associated bug report to get the patch integrated.
In other news, school restarted with its bunch of new responsibilities, limiting significantly free hacking time.
Here are some tips you should follow if you want to get the maximum performance out of a Linq query parallelized with PLinq (at least with upcoming Mono version) :
Use an indexed data structure as your source like an array, a list or anything which implements the generic IList<T> interface.
Never use an ordering operator like OrderBy and never assume that the query should be ordered.
The overloads of some operator that provide an index integer are also to avoid.
As a general rule, try to stick to the general scheme of Select-Where-Aggregate with any number of Select and Where (like the famous MapReduce).
The syntactic sugar operators based on Aggregate like Min, Max, Average, etc… can also be used.
If you can manage it in your code, use the ForAll method with an action delegate instead of iterating over the query with foreach
Of course, forbid any synchronization (locks, semaphore, …) inside the operator selectors/predicates. The purest your lambdas are, the better.
The functions used with operators should be predictive and stable i.e. not depend on something uncertain time-wise like a network call and should yield approximately the same execution time with each input.
Sure, this is not always possible but if it is, it does prevent the engine from having to repeatedly balance the query execution itself.
The PLinq MSDN page contains some additional tricks and explanations if you are interested.
Erik Meijer, guru at MS Research, has recently given a talk at OSCON 2009 introducing functional programming in a funny way. Highly recommended if you have always wondered what all fuss about side effects and purity is about.
Watching my teammate hacking on moonlight was sure to detain on me someday. So when Alan talked about making Moonlight run on top of OpenVG I got pretty hooked.
Two hacking days later, I actually got something to « work ». At the moment it’s quite rough, hacky and it probably kills kitteh too (be careful, it makes shana angry, you wouldn’t like that).
Basically, what I did is to plug the OpenVG layer inside Moonlight custom version of cairo (using that code as a base) and then tweaked Moonlight to use the new surface (together with some changes in how drawing and caching is done internally).
Following is a screencast of the thing running Bubble Mark :
As you can see there are a lot of drawing issues remaining but the basic stuff is here. The code is not terribly faster (+10 fps or so) but that may come either from a bug in my graphic card driver (it already does the bizarre thing of slowing down after some time) or an other part of Moonlight.
It will definitely be better when OpenVG becomes more widespread, has more optimized implementations and can actually run on its own rather than on top of OpenGL (I’m eager to try that on top of Gallium3D when it will be ready).
As for inclusion in the mainline tree, I don’t know. I mostly did the thing for fun as a proof-of-concept and it’s certainly far too crappy to ever get integrated as is, but maybe someone will step up and do it correctly later .
After fighting a bit with Gtk# widget styling and MonoDevelop tarball deployment, here is a new Zencomic.
Summary
Zencomic is the comic strip-driven productivity enhancer that periodically makes your day funnier by showing comic like Dilbert or XKCD in a bubble.
What’s new aka The Cool Stuff ™
New, window-based, popup
Tired of having some comic showing far too small ? This is for you !
Now, if you go to the preference dialog, you will be able to switch to a window-based popup which shows your comics in all their greatness at the expense of taking more window space and making your boss, who was incidentally passing by, angry at you (in that case, a quick click on the popup will close it).
Can I haz lolcats ?
Lolcat greatness is here with the addition of a new addin :
The remaining
For the Gnome Do junkie, Zencomic now correctly comes with a .desktop file so that you can launch it from there
Made the preference dialog show in a little saner way i.e. by coming up directly at the front (which apparently wasn’t the case with some WM).
The traditional round of bugfixes (should you still spot one don’t hesitate to manifest in the comments)