Older blog entries for alex (starting at number 16)

17 Dec 2004 (updated 17 Dec 2004 at 16:24 UTC) »

I've been playing with cairo and xpdf the last few days, trying to make a cairo-based backend for xpdf. That should allow nice antialiased graphics and eventually full PDF 1.3 transparency support.

However, when I tried to render a page in a PDF file I had lying around it was rendering very slowly. I know the Cairo authors have said that they're focusing on design and correctness for now, and that there are lots of optimizations that are not yet done. However, I was getting rendering speeds of a few characters per second, and the full page took 4 minutes and 30 seconds to render. Clearly something was wrong.

So, I fired up the profiler to get a better understanding of what was going wrong. It appears that I was using a non-rectangular clip region, which in Cairo is implemented by an alpha buffer (called the clip surface) that is used as a mask when drawing to the target. When drawing a glyph cairo was allocating a temporary image for drawing the glyph into. Unfortunately it was allocating a termporary buffer the same size as the clip surface, even though the glyph drawn into it was much smaller. In my case, the clip surface was 1240x1754 pixels!

I fixed this in several places so that it only allocated the smallest temporary buffer needed. Rendering was a lot faster now, but profiling showed another large slowdown. When clearing the clip surface and temporary buffers it was somehow using the super-generic pixel compositing functions! I looked into this and discovered that the libpixman solid rectangle fill functions were disable since they were not implemented yet.

After implementing solid rectange fills I was now down to 2.42 seconds for rendering the PDF page. Thats a speedup of over 10000%, in just a days work! I've sent the patches to the cairo list, and I hope they'll get applied soon.

Sometimes optimization is extremely hard. I've personally spent years trying to make Nautilus faster. Its gotten better, but its very hard work. But for software in their early stages of life, optimization is a fun and very rewarding excercise.

In the end I also looked into why it was using the clip surface so much, and it turns out that the page size (crop box) of the page when transformed to device coordinates didn't end up on integer coordinates. This meant cairo had to use a clip surface for the whole page, just to clip the last half a pixel of the rightmost column. By tweaking the crop box to have integer coordinates I got another 400% speedup. And it even looks better than with the original clipping.

I finally got the image from the MRI scan, so now I know what my brain looks like. (Warning, large image.)

Visited the "Ballance lab" at the hospital today, but they couldn't really find anything. It seems I'll never know exactly what caused the problems I had, although everyone seems to think that its benign.

I asked for a copy of the MRI scan, they're gonna send it to me later. Having a picture of your brain will be cool.

Its getting better though. Hopefully it'll be mostly gone by the end of the week.

Spent all day today at the hospital, trying to figure out what is causing the dizziness. It doesn't seem to be Benign Positional Vertigo, since I don't have the characteristic eye movement. At least the MRI scan didn't show anything nasty, so its likely nothing too bad. The current theory is that its some form of inner-ear problem. Maybe I'll find out tomorrow.

And I even forgot to ask for a copy of the MRI scan. I have to ask for that tomorrow.

Some weekends are good, some are not. This one doesn't rank particularly high on the list.

This Saturday I was at a party at a friends place, I was feeling fine, and things were good. However, suddenly while I was standing up and talking to some people I got very very dizzy. I had trouble standing up and almost fell down while trying to get to a chair. I was sweating badly and had nausea.

My friends dad drove me to my parents place which was nearby, where my dad (who is a doctor) gave me the diagnose Benign Positional Vertigo. I don't see whats benign about it, I had to lie still the rest of the weekend and could hardly even walk without support.

I'm a little better now, but I still have trouble walking, and I get very dizzy when I move my head. I've gotten better at keeping my head very still, so I can cope with it a bit better. Hopefully it'll just go away eventually.

Experiencing something like this suddenly happening when you were feeling fine is pretty scary. It makes you think about the fragility and complexity of the human body, and how suddenly things can go bad.

I understand that ALSA is the Linux Sound system of the future. Its apparently really powerful, which the hard-core audio people like. However, somewhere along the way, it seems like the whole power thing went overboard.

Check out this screenshot of the volume control for my Trident 4D Wave card. Clearly someone should have been thinking a bit more about the user experience before exposing all that to the user.

Does anyone know what "Sigmatel Surround Phase Inversion Playback" is? Or what the various PCM sliders do?

We're deep into the Gnome 2.8 hard code freeze, and I really should be fixing bugs all day... However, I was talking to Joe Orton yesterday about webdav servers, and it made me very exited about a good idea for userlevel filesharing.

So, I spent some hours today hacking up an application that lets you share ~/Public as a webdav folder, using apache running in the desktop session. The webdav server then gets published via mDNS so that it immediately shows up in the "Network" location in Nautilus on all computers on the local network. As a user, all you need to do is to enable file sharing and everything magically works.

Enabling is done via gconf at the moment, although obviously there should be a user interface for this. It needs a user interface to edit the .htaccess file too.

Check out this screenshot from my test machine, showing how the local Public folder (for the gnome user) is shared, and how I'm browsing the share from another machine (alex's public files).

fejj: Check out libelf and libdwarf in uli's elfutils.

mrcsparker:

The reason the gnome-vfs ssh method doesn't work with ptys is because you didn't send us a patch to make it work.

There isn't any deep secret why this hasn't been done, just the normal reason: not enough time for the people working on it, not enough people working on it.

See also: http://bugzilla.gnome.org/show_bug.cgi?id=117633

badger: no

7 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!