Blame doc/BENCHMARKING

Packit c32a2d
O-tone Michael Hipp: The mp3 benchmarking lie?
Packit c32a2d
----------------------------------------------
Packit c32a2d
Packit c32a2d
Let's write a few notes about benchmarking the different mp3 decoders,
Packit c32a2d
which are available. 'top' is NOT a benchmark, it's a simple check
Packit c32a2d
how a program performs. The sad thing with 'top' is, that it has some
Packit c32a2d
problems with the measurement of threaded programs of programs only
Packit c32a2d
requesting short chunks of processor time. So, the only real test is
Packit c32a2d
probably decoding a stream without threads with 100% CPU time and
Packit c32a2d
measure the time how long your machine needs for it.
Packit c32a2d
You can do this with mpg123 by doing a
Packit c32a2d
  time mpg123 -t mp3stream.mp3
Packit c32a2d
or
Packit c32a2d
  time mpg123 -s mp3stream.mp3  > /dev/null
Packit c32a2d
if you additionally want to measure the I/O time. 
Packit c32a2d
Packit c32a2d
If you find a player, which claims to be 10 or even more times faster than the
Packit c32a2d
current players: just don't believe it. A factor of 2 MAY BE possible.
Packit c32a2d
Packit c32a2d
Packit c32a2d
Thomas's mpg123 decision process
Packit c32a2d
--------------------------------
Packit c32a2d
Packit c32a2d
I made some tests back then when I wondered  if there is a point in using another "modern" mp3 decoder for my mixing daemon. This was around Dec. 2004 till Feb. 2005 with current versions (0.59r-thorX in the case of mpg123). What follows is a copy of the DECODERS file in the dermixd distribution:
Packit c32a2d
Packit c32a2d
What decoder should one use?
Packit c32a2d
Packit c32a2d
-----
Packit c32a2d
 MP3
Packit c32a2d
-----
Packit c32a2d
Packit c32a2d
mpg123 is the old-fashioned way, uncertain license, may have some problems with extraordinary files (huge id3v2 tags, other specialities?), but fast. Has EQ control; interactive frontend interface (in parts hacked by me...).
Packit c32a2d
Packit c32a2d
mpg321: is popular these days... interface? speed?
Packit c32a2d
Packit c32a2d
madplay: is becoming popular these days, handles RVA2 by itself... can't provide an interface nor EQ
Packit c32a2d
Packit c32a2d
Packit c32a2d
speed:
Packit c32a2d
Packit c32a2d
decoding Dirty Guitar with NULL output, pentium-optimized (not more):
Packit c32a2d
Packit c32a2d
decoder	user time/s
Packit c32a2d
mpg123	23
Packit c32a2d
madplay(hq)	46
Packit c32a2d
madplay(speed)	34
Packit c32a2d
mpg321(hq)	62
Packit c32a2d
mpg321(speed)	49
Packit c32a2d
Packit c32a2d
Packit c32a2d
So, there is still a strong technical point in using mpg123... even when my 366MHz-Laptop can easily handle several decoders at once with either of the programs, every percent cpu usage drags on the battery... and takes the cpu time from the real work
Packit c32a2d
Packit c32a2d
-----
Packit c32a2d
 OGG
Packit c32a2d
-----
Packit c32a2d
Packit c32a2d
7,9M	/tmp/dirty_guitar-q3.ogg
Packit c32a2d
11M	/tmp/dirty_guitar-q5.ogg
Packit c32a2d
13M	/tmp/dirty_guitar-q6.ogg
Packit c32a2d
15M	/tmp/dirty_guitar-q7.ogg
Packit c32a2d
22M	/tmp/dirty_guitar-q9.ogg
Packit c32a2d
29M	/tmp/dirty_guitar-q10.ogg
Packit c32a2d
14M	/tmp/dirty_guitar-std.mp3
Packit c32a2d
101M	/tmp/dirty_guitar.wav
Packit c32a2d
Packit c32a2d
speed of ogg123:
Packit c32a2d
Packit c32a2d
quality	user time/s
Packit c32a2d
3	31
Packit c32a2d
5	36
Packit c32a2d
6	38
Packit c32a2d
7	39
Packit c32a2d
10	55
Packit c32a2d
Packit c32a2d
So, with similar care as mpg123 concerning some (assembler?) optimization, ogg could well come close to "fast" mp3 decoding.
Packit c32a2d
Does ist sound better, then?
Packit c32a2d
Packit c32a2d
Packit c32a2d
A review from the new maintainer
Packit c32a2d
--------------------------------
Packit c32a2d
Packit c32a2d
Now it's 2006, 23th of July. Still the same laptop, still the same mp3 file.
Packit c32a2d
I just want to update the number for current mpg123 with the mmx optimization.
Packit c32a2d
I should also see if competition (well, ogg, at least?) improved in the year that passed... but looking only at mp3, that reduces to the question if mpg123 got faster or slower.
Packit c32a2d
Neither on the mpg321 site or the MAD site (ftp dir) did I find any new version. MAD is still 0.15.1b (0.15.2b for madplay), mpg321 still 0.2.10 .
Packit c32a2d
Well, I can look at mplayer's mpg123 spawn called mp3lib that has been taken care for over the time.
Packit c32a2d
But apart from that, will mpg123 stand alone on the field of console mp3 engines that are actively maintained???
Packit c32a2d
To have at least some twist, I now measured the output of raw data to stdout (to /dev/null) instead of decoding alone. The hardware and largely the software is still the same (now kernel 2.6.11 instead of 2.6.?).
Packit c32a2d
I've only used the "high quality" mad players - the earlier measurements give a hint about the difference to the "speed" variant.
Packit c32a2d
Packit c32a2d
mpg123-0.60-beta1, underworld_@_dirty_guitar.mp3
Packit c32a2d
Packit c32a2d
gcc-3.3.3
Packit c32a2d
CFLAGS=-O2 -finline-functions -march=pentium2
Packit c32a2d
built with the new autoconf/make system
Packit c32a2d
machine in X11 running fluxbox, no active load (like a year ago)
Packit c32a2d
measuring second run (with cached file)
Packit c32a2d
Packit c32a2d
time for -s > /dev/null decode...
Packit c32a2d
pentium:	24s
Packit c32a2d
pentium, MMX:	19s
Packit c32a2d
pentium, MMX, gapless (runtime-disabled): 19s
Packit c32a2d
pentium, MMX, gapless (also runtime-enabled): 19s
Packit c32a2d
mpg321 0.2.10, high quality: 64s
Packit c32a2d
madplay 0.15.2b, high quality: 56s
Packit c32a2d
Packit c32a2d
With the file length being m:s 9:58 (598s), for mpg123 that makes theoretical realtime cpu 3-4% for the PII-366.
Packit c32a2d
Incidentally, `top` agrees there: it shows 3.0-3.3% CPU usage for the MMX/gapless binary during normal OSS playback.
Packit c32a2d
Packit c32a2d
I feel unable to benchmark the mp3 playback of mplayer - I don't see an option to make it decode audio as fast as possible (I only know -benhcmark and -noaudio; with esp. the latter not helping me there).