示例#1
0
        public void InvokeXmlReader(TestInvoke context)
        {
            long length = 0;

            char[] buffer = new char[4 * 1024 * 1024];

            context.BenchmarkReader("text-length", "revision", reader =>
            {
                int depth = reader.Depth;

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "text")
                    {
                        int read = 0;

                        do
                        {
                            read   = reader.ReadChars(buffer, 0, buffer.Length);
                            length = length + read;
                        }while (read > 0);
                    }

                    if (depth == reader.Depth)
                    {
                        return;
                    }
                }
            });

            context.Complete(length);
        }
示例#2
0
        public void InvokeXmlLinq(TestInvoke context)
        {
            long count = 0;

            context.BenchmarkLinq("just-seek", "revision", node =>
            {
                Interlocked.Add(ref count, 1);
            });

            context.Complete(count);
        }
示例#3
0
        public void InvokeXmlReader(TestInvoke context)
        {
            long count = 0;

            context.BenchmarkReader("just-seek", "revision", reader =>
            {
                Interlocked.Add(ref count, 1);
            });

            context.Complete(count);
        }
示例#4
0
        public void InvokeXenonStatic(TestInvoke context)
        {
            long count = 0;

            context.BenchmarkStatic("just-seek", "revision", document =>
            {
                Interlocked.Add(ref count, 1);
            });

            context.Complete(count);
        }
示例#5
0
        public void InvokeXenonDynamic(TestInvoke context)
        {
            long length = 0;

            context.BenchmarkDynamic("text-length", "revision", document =>
            {
                Interlocked.Add(ref length, document.GetDynamic().text.ToText().GetLength());
            });

            context.Complete(length);
        }
示例#6
0
 public void InvokeXmlLinq(TestInvoke context)
 {
     throw new System.NotImplementedException();
 }