-Large project:
---------------
-
- Drop FindMembers as our API and instead extract all the data
- out of a type the first time into our own datastructures, and
- use that to navigate and search the type instead of the
- callback based FindMembers.
-
- Martin has some some of this work with his TypeHandle code
- that we could use for this.
-
-Notes on memory allocation
---------------------------
-
- Outdated:
-
- A run of the AllocationProfile shows that the compiler allocates roughly
- 30 megabytes of strings. From those, 20 megabytes come from
- LookupType.
-
- See the notes on current_container problems below on memory usage.
-
-LookupTypeReflection:
----------------------
-
- With something like `System.Object', LookupTypeReflection will be called
- twice: once to find out that `System' is not a type and once
- for System.Object.
-
- This is required because System.Reflection requires that the type/nested types are
- not separated by a dot but by a plus sign.
-
- A nested class would be My+Class (My being the toplevel, Class the nested one).
-
- It is interesting to look at the most called lookups when bootstrapping MCS:
-
- 647 LTR: ArrayList
- 713 LTR: System.Globalization
- 822 LTR: System.Object+Expression
- 904 LTR: Mono.CSharp.ArrayList
- 976 LTR: System.Runtime.CompilerServices
- 999 LTR: Type
- 1118 LTR: System.Runtime
- 1208 LTR: Mono.CSharp.Type
- 1373 LTR: Mono.Languages
- 1599 LTR: System.Diagnostics
- 2036 LTR: System.Text
- 2302 LTR: System.Reflection.Emit
- 2515 LTR: System.Collections
- 4527 LTR: System.Reflection
- 22273 LTR: Mono.CSharp
- 24245 LTR: System
- 27005 LTR: Mono
-
- Analysis:
- The top 9 lookups are done for things which are not types.
-
- Mono.CSharp.Type happens to be a common lookup: the class Type
- used heavily in the compiler in the default namespace.
-
- RED FLAG:
-
- Then `Type' is looked up alone a lot of the time, this happens
- in parameter declarations and am not entirely sure that this is
- correct (FindType will pass to LookupInterfaceOrClass a the current_type.FullName,
- which for some reason is null!). This seems to be a problem with a lost
- piece of context during FindType.
-
- System.Object is also used a lot as a toplevel class, and we assume it will
- have children, we should just shortcut this.
-
- A cache:
-
- Adding a cache and adding a catch for `System.Object' to flag that it wont be the
- root of a hierarchy reduced the MCS bootstrap time from 10.22 seconds to 8.90 seconds.
-
- This cache is currently enabled with SIMPLE_SPEEDUP in typemanager.cs. Memory consumption
- went down from 74 megs to 65 megs with this change.
-