In DroidDetector.getMimeTypeFromResults, the first result from droid detection is used for the MIME-type and the rest of the droid results are discarded, except that the total number of results are used to determine whether or nor to muck about with the version number.
The problem here is that droid tries all signatures on the input, which is not ideal when only 1 result is really used. It seems simple to add an exit-on-first-hit to the droid code in (InternalSignatureCollection.getMatchingSignatures), which, assuming random order of signatures and matches, would cut processing time in half. With a bit of prioritization of the signatures where the most common MIME types are checked first, there should be a significant speed-gain.
The price is that it will not be possible to determine whether or not there were multiple signature matches. This means that the version number will either be (more) un-reliable or always missing. This might call for making it the optimization optional: "Slow parsing with version" or "Fast parsing without version".
In
DroidDetector.getMimeTypeFromResults, the first result from droid detection is used for the MIME-type and the rest of the droid results are discarded, except that the total number of results are used to determine whether or nor to muck about with the version number.The problem here is that droid tries all signatures on the input, which is not ideal when only 1 result is really used. It seems simple to add an exit-on-first-hit to the droid code in (
InternalSignatureCollection.getMatchingSignatures), which, assuming random order of signatures and matches, would cut processing time in half. With a bit of prioritization of the signatures where the most common MIME types are checked first, there should be a significant speed-gain.The price is that it will not be possible to determine whether or not there were multiple signature matches. This means that the version number will either be (more) un-reliable or always missing. This might call for making it the optimization optional: "Slow parsing with version" or "Fast parsing without version".