xbmc/xbmc — pull request #1581 by Montellese (2012-10-09 08:39:59+00:00)
Title: jsonrpc: optimize handling of properties requested by the client

Up until now FillDetails, which contains a loop to go through all the properties requested by the client in a request has been called at least twice (once for the CFileItem and once for the CFooInfoTag) for every media item matching the client's request. With n items and m properties this resulted in n * 2 * m loops which can result in longer response times. By removing the already matched properties from the list of requested properties we get down to n * m loops. Especially for "expensive" properties like "thumbnail" and "fanart" which require additional SQL queries avoiding doing the same work twice which can have a huge impact.
In addition moving the logic to retrieve any requested properties directly from the serialization of the media item instead of first checking and handling any special cases results in additional speed-up by not having to do the extra string comparisons and map-lookups required for the special cases.

I mainly put this up as a PR (it's actually more of a fix) because I don't like all the
```
fields.erase(field);
continue;
```
and thought maybe someone has an idea for this. The only thing I could come up with was replacing those lines with a goto but I hope there's another solution.