VLC on a diet

Deep underneath the user-visible parts, the VLC media player has undergone a major diet over the past three years. If I start any of the last three major VLC releases or the current development branch on one of my (Linux) computers, I can observe the following while the player is totally idle (i.e. not playing any media):

Version Wake-ups per second Threads with timer Threads without timer
0.8.6 119 6 0
0.9 T.B.D. 2 8
1.0 0,033 1 8
HEAD 0 0 4

The threads are sleeping as follow:

0.8.6

0.8.6 was the last VLC release made before powertop came out. At that time, condition variables were very seldom used. Instead, most threads would simply poll for events at short interval. In fact, VLC 0.8.6 (and earlier) was riddled with race conditions. However, this was most often unnoticed, as threads were not synchronized, and processors were not multi-core. Hence, VLC threads were rarely running in parallel.

0.9

With 0.9.0, the most obvious problems with threading were fixed. But the number of threads exploded:

1.0

Version 1.0.0 brought further but slight improvements over 0.9. All timers in the interface code were removed, and a few threads were removed. On the other, the global hotkey interface was added as a new feature.

1.1 (as of 2009)

With version 1.1.0, and assuming the Qt4 theme engine is not faulty, VLC would normally not wake-up while idle at all anymore. Furthermore, most not-so-useful threads were removed. The playlist thread remains, but I have plans to remove it as well.