Quantcast
Channel: Squeezebox : Community : Forums - Logitech Media Server
Viewing all articles
Browse latest Browse all 5300

performance issue with LMS supplied SOX binary

$
0
0
On ubuntu (specifically Zorin 16.1 but the issue is the same on different releases of ubuntu), there is a substantial performance difference between the SOX binary supplied with LMS and SOX compiled natively.

Testing has been done with various versions of LMS (7.9.3 to 8.2.0).

The flac file under test is 16 bit, stereo, 44.1 kHz, being the Albert King track "Born Under A Bad Sign" from the album of the same name. File size is 17mb

Test results are the same for any number of different tracks.

Using a "/tmp" that is memory mounted (to negate questions around disk access.. the results are the same when redirecting to /dev/null), if we run the following script:

df /tmp
pwd
time dd if=./test1.flac | ./soxlms -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
time dd if=./test1.flac | ./soxlms -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
time dd if=./test1.flac | ./soxlms -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
time dd if=./test1.flac | ./soxlms -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
ls -l ./test1.flac ./bob1.flac
time dd if=./test1.flac | ./soxnew -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
time dd if=./test1.flac | ./soxnew -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
time dd if=./test1.flac | ./soxnew -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
time dd if=./test1.flac | ./soxnew -D -q -t flac - -t flac -C 0 -b 24 --buffer 131072 - gain -h -n -4 rate -v -b 95.4 -p 45 -a 96000 > ./bob1.flac
ls -l ./test1.flac ./bob1.flac


We get the following results:

Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1048576 44908 1003668 5% /tmp
/tmp
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.314792 s, 55.4 MB/s

real 0m4.443s
user 0m4.437s
sys 0m0.088s
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.313073 s, 55.7 MB/s

real 0m4.435s
user 0m4.412s
sys 0m0.105s
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.313596 s, 55.6 MB/s

real 0m4.434s
user 0m4.445s
sys 0m0.070s
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.311058 s, 56.0 MB/s

real 0m4.445s
user 0m4.396s
sys 0m0.126s
-rw-rw-r-- 1 ricko ricko 58054942 Oct 10 12:42 ./bob1.flac
-rw-rw-r-- 1 ricko ricko 17424195 Oct 10 12:41 ./test1.flac
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.253777 s, 68.7 MB/s

real 0m1.760s
user 0m1.722s
sys 0m0.092s
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.240268 s, 72.5 MB/s

real 0m1.745s
user 0m1.711s
sys 0m0.101s
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.23839 s, 73.1 MB/s

real 0m1.742s
user 0m1.728s
sys 0m0.083s
34031+1 records in
34031+1 records out
17424195 bytes (17 MB, 17 MiB) copied, 0.241787 s, 72.1 MB/s

real 0m1.743s
user 0m1.705s
sys 0m0.109s
-rw-rw-r-- 1 ricko ricko 58054942 Oct 10 12:43 ./bob1.flac
-rw-rw-r-- 1 ricko ricko 17424195 Oct 10 12:41 ./test1.flac


Note the run time difference between the two and the fact the upsampled file sizes (bob1.flac) are the same.

This test shows that on average, the LMS supplied SOX takes 4.44 seconds to run while the natively compiled one takes 1.74 seconds meaning the LMS version is 2.5 times slower.

The respective SOX exe's have the following basic profile:

soxlms: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, stripped
soxnew: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, with debug_info, not stripped

I didnt bother to strip my exe.

My GCC version is gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

Looking at "ldd" we see a large difference in libraries used:

ldd soxlms
linux-vdso.so.1 (0x00007ffc6cdef000)

libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffbac6ea000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffbac4f8000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffbac85d000)

ldd soxnew

linux-vdso.so.1 (0x00007ffd7e9de000)
libsox.so.3 => /lib/x86_64-linux-gnu/libsox.so.3 (0x00007faec1ffa000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faec1eab000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faec1e88000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faec1c96000)
libltdl.so.7 => /lib/x86_64-linux-gnu/libltdl.so.7 (0x00007faec1c8b000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007faec1c53000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007faec1c35000)
libmagic.so.1 => /lib/x86_64-linux-gnu/libmagic.so.1 (0x00007faec1c0d000)
libgsm.so.1 => /lib/x86_64-linux-gnu/libgsm.so.1 (0x00007faec1bfe000)
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007faec1bbc000)
/lib64/ld-linux-x86-64.so.2 (0x00007faec20bc000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007faec1bb6000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007faec1b8b000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007faec1b78000)



Looking at "top" during the testing, the LMS SOX binary uses 100% CPU (the test system isnt a dog!!!) while the natively compiled SOX binary uses ~43% CPU

Obviously for me, the issue isnt an issue cause I have recompiled SOX so justed wanted to raise this more as an FYI than an issue.

On a low powered, fanless endpoint (such as what I use in "production") it means with the LMS supplied SOX, the upsample can run for 20, 30 or 40 seconds, depending on track size.

Peter

Viewing all articles
Browse latest Browse all 5300

Trending Articles