<br><br><div class="gmail_quote">On Wed, Oct 31, 2012 at 8:17 AM, Sean Dague <span dir="ltr"><<a href="mailto:sdague@linux.vnet.ibm.com" target="_blank">sdague@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10/30/2012 07:07 PM, Doug Hellmann wrote:<br>
<snip><div class="im"><br>
>     While I get that in production, the class loading will disappear in<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    the noise, that huge hit on the unit tests seems really problematic<br>
    from a developer point of view. And a big problem from a CI<br>
    perspective. Anyone have ideas on why this is such a huge hit, or<br>
    thoughts on how to mitigate it?<br>
<br>
<br>
I haven't profiled it, but my guess is that the extra time is from<br>
scanning the entrypoints registry. That would, as you say, hardly matter<br>
when it is only done once on startup. Perhaps we need to cache driver<br>
loaded from the config outside of the manager (?) instance where it is<br>
used to avoid having to rescan the registry each time the tests set up<br>
the manager.<br>
</blockquote>
<br></div>
Given that in our use case we already know the one class we are loading, is there any reason all the entrypoints are being scanned anyway? That just seems wasteful. And it also seems like it only gets worse as the entrypoint list grows.<br>
</blockquote><div><br></div><div>The code for the entry points are not all being loaded. The *registry* of entry points is being scanned. To perform the scan, pkg_resources looks at the entry point definitions in all packages installed on the system, since part of the point of the registry is your code doesn't have to live inside any particular python package.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As the stevedore author, could you add fast path loading into the library, and fail back to the full scan if something goes wrong on that?</blockquote><div><br></div><div>I'm not sure what you mean by "fast path loading." The name of an entry point does not include enough information, by itself, to find the class; the registry has to be scanned. </div>
<div><br></div><div>Typically way to cache that is to hold on to the extension manager instance, since it already knows about all of the plugins. I'm not sure if that works for the driver manager, if it is trying to load different drivers, since it really only caches the one it is configured to load.</div>
<div><br></div><div>Doug</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
        -Sean<br>
<br>
-- <br>
Sean Dague<br>
IBM Linux Technology Center<br>
email: <a href="mailto:sdague@linux.vnet.ibm.com" target="_blank">sdague@linux.vnet.ibm.com</a><br>
alt-email: <a href="mailto:sldague@us.ibm.com" target="_blank">sldague@us.ibm.com</a><br>
<br>
</div></div></blockquote></div><br>