Share via


WinFX Trivia Quiz: What are the most used APIs in the BCL?

A guy on my team has been playing around with an API usage frequency tool… the idea is to gather data on the most used APIs in the framework. What he does is scan the IL for all calls to methods and sum the number of calls for each API defined in the BCL.

He recently ran this tool over a current build of Longhorn which contains a large managed code base. Can you name any of the methods in the top 10? Think about it a bit, it might be harder than you first think… I’ll post a hint tomorrow if folks are not in the right track.

Comments

  • Anonymous
    January 14, 2004
    String.Compare
  • Anonymous
    January 14, 2004
  1. Microsoft.PlatformSpecificApi.Use();
    9. Hardware.Ram.MaxOut();
    8. Microsoft.Office.Crash();
    7. System.Windows.BlueScreen.Display();
    6. W3C.Standards.Ignore(true);
    5. Secrets.UndocumentedClass.ReallyCoolMethod();
    4. Marketing.Xmlizer.Xmlize(Everything);
    3. System.Math.Random.CreateAcronym();
    2. ScobleVisibleAttribute.ctor(false);
    1. Drinks.KoolAid.Pour();




  • Anonymous
    January 14, 2004
    String.Compare is good.
    XmlDocument.SelectSingleNode and .SelectNodes
  • Anonymous
    January 14, 2004
    object.ToString()?
  • Anonymous
    January 14, 2004
    Control.Invalidate ?
    Dispose ?
    Debug.WriteLine ?
    Stream.Read ?
  • Anonymous
    January 14, 2004
  • Anything in the String class (particularily String.Format).

    - Probably the ctor for Exception.

    - XPathNavigator.Select();

  • Anonymous
    January 14, 2004
    Good guesses so far... this is not really a hint, more of clarification. For the purposes of this question assume the BCL is only stuff in MSCorLib and System.dll -- so no xml.
  • Anonymous
    January 14, 2004
    Are you counting how many calls are in the source or which get called the most at runtime?

    System.String functions. Do I need to guess which ones? .ctor and Compare would be my guess.

    System.StringBuilder.

    ArrayList and/or HashTable insert and enumerators.

    Demand on various permissions.

    ToString on various types

    IntPtr.op_Equal

    KC
  • Anonymous
    January 15, 2004
    Convert.ToXXX()
  • Anonymous
    January 15, 2004
    System.Object::.ctor (maybe not called, but certainly used)
    System.IO.MemoryStream.ReadByte
    System.Text.StringBuilder::GetThreadSafeString
    (and perhaps other string functions like NullTerminate?)

  • Anonymous
    January 15, 2004
    Probably a lower level than considered, but how about:
    object.ctor()
    object.Equals()
    followed by the ctors for various integer types...

  • Anonymous
    January 15, 2004
    I'd have to go with object.ToString and its overrides, but those will probably come up separate in the statistics. how about object.GetType()?
  • Anonymous
    January 15, 2004
    Good comments... A couple of folks suggest string.Compare()... The most frequent overload of it is only the 51st most called api, with 295 calls.
    51;System.String.Compare(System.String strA;System.String strB,Boolean ignoreCase;System.Globalization.CultureInfo culture);295

    Other folks have suggested items higher on the list as well.

    Here is your hint: Consider method calls that are not "hidden" by C# or VB syntax...
  • Anonymous
    January 15, 2004
    String.Length
    String.op_Equality / String.Equals
    String.Empty
    ArgumentException.ctor
    ArgumentNullException.ctor