Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Great comments from my last post... Here is my interpretations, comments\disagreements welcome ;-)
1,System.Type.GetTypeFromHandle(System.RuntimeTypeHandle handle),15399
As was mentioned in my comments, this is from the C# keyword “typeof”
Type t = typeof (MyType) ;
2,System.Byte[,,].Set(Int32 ,Int32 ,Int32 ,Byte ),13122
This one and 5 were very interesting… Turned out to all be from the same place in WinFX where we initialize a very large matrix of character data.. here is a sampling….
/// <summary>
/// ArabicFSM, class defines the static finite states for the Arabic and Syriac unicode blocks. The class
/// is used to shape unicode text runs passed in from the Arabic Open Type Engine.
/// </summary>
internal static unsafe class ArabicFSM
{...
static byte [,,] ArabicShapeStateMachine =
{
// ARSYFSM_SHAPE_NOTSHAPED
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
{
{NCYNS, NC_IS, NC_IS, NC_IS, NC_IS, NCYNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCNNS, NCYNS, NCYNS, NCYNS, NCYNS}, // 0-ARSYCH_NONJOIN,
{INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, NCYNS}, // 1-ARSYCH_DUALJOIN,
3,System.IDisposable.Dispose(),3488
From C#’s using statement such as:
using (StreamReader r = File.OpenText() ) {}
4,System.Resources.ResourceManager.GetObject(System.String name),2845
Many were from code that looks up an exception message text:
throw new MyException (rm.GetObject (“message”));
5,System.Byte[,].Set(Int32 ,Int32 ,Byte ),2692
Same basic idea as 2.
6,System.Text.StringBuilder.Append(System.String value),2588
No tricks here (that I found), really popular API – After all Appending is what StringBuilders are good for.
7,System.Collections.ArrayList.get_Count(),2229
8,System.Collections.IEnumerator.MoveNext(),2158
9,System.Collections.IEnumerator.get_Current(),2083
All of these are to support C# and VB’s foreach statement.. for example
foreach (Type t in Assembly.GetTypes () ) {
}
10,System.Collections.ArrayList.Add(System.Object value),2049
Like 6, no trick, just a popular API…
Comments
- Anonymous
January 19, 2004
Brad, why do the numbers decrease so drastically for Dispose and further down ?? 15K, 13K and then 3.5K ; Whoa !
I was wondering what would be the count for Object.Equals(..) ! I use this method pretty often compared to the more C++ styled == operator and somehow got the impression that every parameter check for methods, every constructor check on params, property assignment check should use this invariably to check whether valid data is being passed. Am i missing something here ??
Also how about 'is' operator ? - Anonymous
January 19, 2004
#2,#5 I find this as very slow. AFAIK every access to ArabicShapeStateMachine will perform 3 bound checks. Why dont you use a flat array instead?
#3 the majority is (imho) at foreach statements(they are about 2k enumerators that must be disposed)