(a bit of) whitespace

Has someone just said “lowlevel”?

Reaching the Limits of Adobe Stupidity

Lately, I’ve been working on Flash ActionScript 3 decompiler, and I noticed an interesting pattern. Normally, if you work with a piece of well-known software and something goes wrong, it’s your fault. But with Flash it’s not anything like that! If it doesn’t work, then it’s probably a bug in the compiler which was preserved for compatibility. Or the specification is plain wrong. Or it’s a bug in the compiler which no one noticed or attributed to cosmic rays instead.

I’ll give a few examples.

Statically Compiled Ruby

Ruby is a very dynamic language by its nature, and it has quite a generalized interface. Everything is an object, objects communicate only by sending messages to each other, variables are untyped and everything can be modified at runtime, even (almost) any of the builtins.

This has a serious drawback, through: evaluating Ruby code is a slow process. Even when you have an expression like 5 + 2 (which is syntactic sugar for 5.+(2)), one cannot safely assume that + method has not been redefined as something completely different. Thus, one is required to follow the generic method lookup procedure, which isn’t trivial at all and therefore isn’t fast either.

I have found a way, through, to significantly improve Ruby code performance by restricting just a few of its metaprogramming capabilities.

Strace and V4L2

Let’s suppose you have a webcam which works with Skype, but does not with your V4L2 code. You start Skype under strace… and suddenly discover that it does not know any of the V4L2 ioctl’s and shows them like this:

ioctl(117, VIDIOC_S_PARM or VIDIOC_S_PARM_OLD, 0xb1025024) = 0

That’s not very useful. If only you could get something like this…

ioctl(117, VIDIOC_S_PARM or VIDIOC_S_PARM_OLD, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE, capability=V4L2_CAP_TIMEPERFRAME, capturemode=0, timeperframe={numerator=1, denominator=30}, extendedmode=0, readbuffers=0}) = 0

Sure you can. Just grab the patch against strace 4.6 source, apply it, compile (don’t forget autoreconf -i) and rejoice.

Tweaking Linux TCP Stack for Lossy Wireless Networks

Public wireless networks are often congested and located in a noisy RF environment. Standard TCP congestion control algorithms work inefficiently in these conditions, leading to frequent timeouts, large RTTs and poor overall performance. There are some tricks, however, which can be enabled to improve it a lot.

Fixing ACPI on Samsung N250

In this article I’d like to describe some of the typical BIOS design flaws of a modern netbook, and methods which can be used to locate, dissect and heal the bugs.