In the introducing Volumio 2 topic in the forums Michelangelo suggested that the performance of the MPD plugin needed looking at.
I am still learning how all this hangs together but my developer spidey sense is making me think the the usage of the Node string library may be a bit of an overhead. For example currently the searchFor method looks like this
[code]ControllerMpd.prototype.searchFor = function (lines, startFrom, beginning) {
var self = this;
var count = lines.length;
var i = 0;
while (startFrom + i < count) {
var line = s(lines[startFrom + i]);
if (line.startsWith(beginning))
return line.chompLeft(beginning).trimLeft().s;
else if (line.startsWith('file:'))
return '';
else if (line.startsWith('directory:'))
return '';
i++;
}
};[/code]
I do not know whether or not this is used a lot, but it shows what I think might be unnecessary work being done
I haven’t tested it yet, but it could be done without the string library (and therefore letting the V8 engine get on with things - a bit like this
[code]ControllerMpd.prototype.searchFor = function (lines, startFrom, beginning) {
var count = lines.length;
var i = startFrom;
while (i < count) {
var line = lines[i];
if (line.indexOf(beginning)===0)
return line.slice(beginning.length);
else if (line.indexOf('file:')===0 ||line.indexOf('directory:'==0)
return '';
i++;
}
};[/code]
in this case , the string library does a lot of extra stuff in order to do what the string library can already do…
But I may be wrong
If I get some time today I will look into this more.