The first time you do a dir() of Form, we have to use Reflection to introspect<br>- every member on Form<br>- every member on ContainerControl<br>- every member on ScrollableControl<br>- every member on Control<br>- every member on Component<br>
(aka the inheritance hierarchy of Form :D )<br><br>After that, the members are all cached and subsequent access should be quite fast.<br><br><div class="gmail_quote">On Sat, May 23, 2009 at 4:47 PM, Michael Foord <span dir="ltr">&lt;<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Michael Foord wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br>
<br>
On IronPython 2.0.1 the last line of this code takes ~4 seconds the first time it is executed:<br>
<br>
&gt;&gt;&gt; import clr<br>
&gt;&gt;&gt; clr.AddReference(&#39;System.Windows.Forms&#39;)<br>
&gt;&gt;&gt; from System.Windows.Forms import *<br>
&gt;&gt;&gt; dir(Form)<br>
<br>
Form.__dict__.keys() (which for a .NET type is equivalent) takes ~1 second or less. What extra work is dir doing? (Is it pulling in the xml docstrings?)<br>
<br>
</blockquote>
<br></div>
Actually they&#39;re not equivalent, my bad:<br>
<br>
&gt;&gt;&gt; len(Form.__dict__)<br>
287<br>
&gt;&gt;&gt; len(dir(Form))<br>
540<br><font color="#888888">
<br>
Michael</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks<br>
<br>
Michael<br>
<br>
</blockquote>
<br>
<br>
-- <br>
<a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br>
<a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></blockquote></div><br>