When the autoloader currently receives a class to be loaded, it generates an array of possible paths that class may be found in. Furthermore it uses stream_resolve_include_path() to resolve these paths. This leads to a lot of unncessary "does that file exist" checks and provokes issues like #9524.
To fix this problem, the autoloader should be made entirely deterministic. That means, given a class name, the autoloader should take that class name and transform it into a file path (deterministically, without looking at the filesystem). Only this single file should be tried to be loaded.
If the file does not exist, an error should be generated (either hard by just using require or soft by performing file_exists() on that single file).
Furthermore the ownCloud autoloader should not make use of stream_resolve_include_path(). This should only be necessary for legacy libraries. These can probably be loaded via the Composer autoloader which ensures only necessary paths are traversed.
Please note that deterministic does not mean that different prefixes can not be used. It will still allow mapping the OCP prefix to the lib/public folder and OC to the lib/private folder.
I filed #9643 to cover the bit about using Composer's autoloader (not OC's) to handle bundled libraries.
The "searching in all possible paths" feature might be in use by core apps. See e.g. https://github.com/owncloud/core/blob/master/apps/files_external/lib/owncloud.php which defines a class OC\Files\Storage\OwnCloud. This breaks determinism.
This is more or less a duplicate of #13241 -> closing.