Skip to content

ClassLoader::findFile() indirection causes measurable overhead. #2120

donquixote opened this Issue Jul 26, 2013 · 0 comments

2 participants


We compare four loaders, each filled with a class map:

  • APC: loadClass() checks APC cache, and if it does not find, checks the class map. No indirection to findFile().
  • ComposerSmartImmediate: loadClass() directly checks the class map.
  • ComposerSmartImmediateReturn: loadClass() directly checks the class map. If the second parameter is true, it will return the file instead of including it.
    This would allow to mimick findFile() without having to copy everything.
  • ComposerSmart: loadClass() calls findFile(), which then looks into the class map.

We can see that the overhead caused by the findFile() indirection is even bigger than the difference caused by APC vs ClassMap.

LOADER                                               DURATION    RATIO   CLASS_EXISTS
> CLASSMAP:     ComposerSmartImmediate:              6.110430μs  (1.21x) 0           
> CLASSMAP:     ComposerSmartImmediateReturn:        6.272978μs  (1.24x) 0           
> CLASSMAP:     APC:                                 8.257363μs  (1.63x) 0           
> CLASSMAP:     ComposerSmart:                       9.140730μs  (1.80x) 0           

Should we care?

@Seldaek Seldaek closed this Apr 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.