I'm reading the book CLR via C#, below is the descrption of what happens the first time a method is called:
Just before the Main method executes, the CLR detects all of the types that are referenced by Main’s code. This causes the CLR to allocate an internal data structure that is used to manage access to the referenced types. In Figure 1-4, the Main method refers to a single type, Console, causing the CLR to allocate a single internal structure. This internal data structure contains an entry for each method defined by the Console type. Each entry holds the address where the method’s implementation can be found. When initializing this structure, the CLR sets each entry to an internal, undocumented function contained inside the CLR itself. I call this function JITCompiler.
I don't understand why CLR allocate a internal structure that contains an entry for each method, image a type has 100 methods and I just use one method, then the CLR will allocate the structure that contains 100 entries for 100 methods, isn't it very inefficient?