Click here to Skip to main content
Click here to Skip to main content

NPerf, A Performance Benchmark Framework for .NET

By , 25 Jan 2004
 

Demo

Introduction

This article present NPerf a flexible performance benchmark framework. The framework provides custom attributes that the user uses the tag benchmark classes and methods. If you are familiar with NUnit [1], this is similar to the custom attributes they provide.

The framework uses reflection to gather the benchmark testers, the tested types, runs the tests and output the results. The user just have to write the benchmark methods.

At the end of the article, I illustrate NPerf with some metaphysic .NET question: interface vs. delegates, string concatenation race, fastest dictionary.

QuickStart: Benchmarking IDictionary

Let's start with a small introductory example: benchmarking the [] assignment for the different implementation of IDictionary. To do so, we would like to test the assignment on a growing number of assignment calls.

All the custom attributes are located in the NPerf.Framework namespace, NPerf.Framework.dll assembly.

PerfTester attribute: defining testers

First, you need to create a tester class that will contains method to do the benchmark. This tester method has to be decorated with the PerfTester attribute.

using NPerf.Framework;

[PerfTester(typeof(IDictionary),10)]
public class DictionaryTester
{
   ...
}

The PerfTesterAttribute constructor takes two argument:

  • the Type of the tested class, interface, or struct,
  • the number of test runs. The framework will use this value to call test methods multiple times (explained below).

PerfTest attribute: adding benchmark tests

The PerfTest attribute marks a specific method inside a class that has already been marked with the PerfTester attribute, as a performance test method. The method should take the tested type as parameter, IDictionary here,  and the return type should be void:

[PerfTester(typeof(IDictionary),10)] 
public class DictionaryTester 
{ 
    // explained below
    private int count;
    private Random rnd = new Random();

    [PerfTest] 
    public void ItemAssign(IDictionary dic) 
    {
         for(int i=0;i<this.count;++i) 
             dic[rnd.Next()]=null;
    }
}

PerfSetUp and PerfTearDown Attributes

Often, you will need to set up you tester and tested class before actually starting the benchmark test. In our example, we want to update the number of insertion depending the test repetition number. The PerfSetUp attribute can be used to tag a method that will be called before each test repetition. In our test case, we use this method to update the DictionaryTester.count member:

[PerfTester(typeof(IDictionary),10)] 
public class DictionaryTester 
{
    private int count;
    private Random rnd = new Random();

    [PerfSetUp] 
    public void SetUp(int index, IDictionary dic) 
    {
        this.count = index * 1000;
    }
}

The set-up method must return void and take two arguments:

  • index, current test repetition index. This value can be used to modify the number of elements tested, collection size, etc...
  • dic, the tested class instance

If you need to clean up resources after the tests are run, you can use the PerfTearDown attribute to tag a cleaning method:

[PerfTester(typeof(IDictionary),10)] 
public class DictionaryTester 
{     
    ...

    [PerfTearDown] 
    public void TearDown(IDictionary dic) 
    {
       ...
    }
}

PerfRunDescriptor attribute: giving some information to the framework

In our example, we test the IDictionary object with an increasing number of elements. It would be nice to store this number in the results, and not store just the test index: we would like to store 1000, 2000, .... and not 1, 2, ...

The PerfRunDescriptor attribute can be used to tag a method that returns a double from the test index. This double is typically used for charting the results, as x coordinate.

[PerfTester(typeof(IDictionary),10)] 
public class DictionaryTester 
{     
    [PerfRunDescriptor] 
    public double Count(int index) 
    {
       return index*1000;
    }
}

Full example source.

The full source of the example is as follows:

using System;
using System.Collections;
using NPerf.Framework;

[PerfTester(typeof(IDictionary),10)] 
public class DictionaryTester 
{     
    private int count = 0;
    private Random rnd = new Random();
    [PerfRunDescriptor] 
    public double Count(int index) 
    {
       return index*1000;
    }

    [PerfSetUp]
    public void SetUp(int index, IDictionary dic)
    {
        this.count = (int)Math.Floor(Count(index));
    }

    [PerfTest]
    public void ItemAssign(IDictionary dic)
    {
        for(int i =0;i<this.count;++i)
           dic[rnd.Next()]=null;
    }
}

Compiling and Running

Compile this class to an assembly and copy the NPerf binaries in the output folder: (NPerf.Cons.exe, NPerf.Core.dll, NPerf.Framework.Dll, NPerf.Report.Dll, ScPl.dll).

NPerf.Cons.exe is a console application that dynamically loads the tester assemblies (that you need to specify), the assemblies that contains the tested types (you need to specify), runs the test and output charts using ScPl [2] (ScPl is a chart library under GPL).

The call to NPerf.Cons.exe looks like this:

NPerf.Cons -ta=MyPerf.dll -tdfap=System -tdfap=mscorlib

where

  • ta defines an assembly that contains tester classes (DictionaryTester),
  • tdfap defines an assembly that contains tested type. Moreover, the assembly names are given as partial name and will be loaded by AssemblyLoadWithPartialName.

There are a number of other options that you can get by typing NPerf.Cons -h. Running the command line above will produce the following chart:

Sample screenshot

In the graph, you can see that some type failed the tests (PropertyDescriptorCollection). It is possible to specify to NPerf to avoid those types by passing them in the command line:

NPerf.Cons -ta=MyPerf.dll -tdfap=System -tdfap=mscorlib 
                       -it=PropertyDescriptorCollection

Saving to XML

You can also output the results to XML by adding the -x parameter. Internally, .NET XML serialization is used to render the results to XML.

A few remarks

  • You can add as many test method (PerfTest) as you want in the PerfTester classes,
  • You can define as many tester class as you want,
  • You can load tester/tested types from multiple assemblies

Overview of the Core

The NPerf.Core namespace contains the methods that do the job in the background. I do not plan to explain them in details but I'll discuss some problem I ran into while writing the framework.

Getting the machine properties

Getting the physical properties of the machine was a surprisingly difficult task. It took me a bunch of Google tries to get on the right pages. Anyway, here's the self-explaining code that get the machine properties:

ManagementObjectSearcher query = new 
  ManagementObjectSearcher("SELECT * From Win32_ComputerSystem");
foreach(ManagementObject obj in query.Get())
{
    long ram = long.Parse(obj["TotalPhysicalMemory"].ToString());    
    break;                
}
            
query = new ManagementObjectSearcher("SELECT * From Win32_Processor");
foreach(ManagementObject obj in query.Get())
{
    string cpu =(string)obj["Name"];                
    long cpuFrequency = 
      long.Parse(obj["CurrentClockSpeed"].ToString());
    break;                
}

TypeHelper, easier CustomAttribute support

A type helper static class was added to automate tedious tasks like check for custom attribute, get a custom attribute, etc... The TypeHelper class declaration is as follows:

public sealed class TypeHelper
{
    public static bool HasCustomAttribute(
        Type t,
        Type customAttributeType);
    public static bool HasCustomAttribute(
        MethodInfo t,
        Type customAttributeType)
    public static Object GetFirstCustomAttribute(
        Type t, 
        Type customAttributeType)
    public static Object GetFirstCustomAttribute(
        MethodInfo mi, 
        Type customAttributeType)
    public static MethodInfo GetAttributedMethod(
        Type t, 
        Type customAttributeType)
    public static AttributedMethodCollection GetAttributedMethods(
        Type t, 
        Type customAttributeType);
    public static void CheckSignature(
        MethodInfo mi, 
        Type returnType, 
        params Type[] argumentTypes);
    public static void CheckArguments(
        MethodInfo mi, 
        params Type[] argumentTypes);
}

Benchmark Bonus

In order to illustrate the framework, I have written a few benchmark testers for classic performance questions about .NET. All these benchmarks are provided in the System.Perf project.

IDictionary benchmark

Adding items


Sample screenshot

Sample screenshot

Sample screenshot

String concatenation benchmark

Sample screenshot

Interface vs. Delegate

Sample screenshot

History

  • 26-01-2004, v1.0, Initial release.

References

  1. NUnit, unit test framework for .NET
  2. ScPl, free chart library

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Jonathan de Halleux
Engineer
United States United States
Member
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralBad Link on PagememberMjlarkin7 Feb '07 - 10:12 
Your link to scpl is bad:
 
http://netcontrols.org/nplot/wiki/index.php?n=Main.Scpl
 
is the correct URL

GeneralRe: Bad Link on PagememberAndrew Phillips17 Sep '08 - 2:48 
Sept 2008: SCPL link is still wrong.
 
Andrew Phillips
http://www.hexedit.com
andrew @ hexedit.com

NewsLicencememberChristian Schweizer23 May '06 - 23:14 
Hi there!
 
I just had a look on your project and it looks very interesting. Im currently thinking about integration NPerf in our own project for benchmarks as implementing an own benchmark framework takes too much time for us...
My question to you is about licensing.
Which license has your project? And is there still developing going on on NPerf?
 
Thanks a lot in advance for your answer! By the way, have you considered to publish your project on sourceforge.net e.g.? It seems as there is nothing like NPerf on sourceforge...
 
Best regards
Christian Schweizer

GeneralCompact FrameworkmemberVasudevan Deepak Kumar14 Mar '06 - 4:03 
Hi,
 
Can this also be used for CompactFramework 2.0 (Windows Mobile/Pocket PC applications)?
 
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At:
http://www.dotnetjunkies.com/weblog/deepak/
http://deepakvasudevan.blogspot.com/
http://deepak.blogdrive.com/
GeneralFramework .Net 2.0memberlmclr10 Feb '06 - 0:53 
Hello,
 
Vey good tool, but does NPerf work with .Net 2.0 ? Wink | ;)
 
Thanks
GeneralRe: Framework .Net 2.0membervalentine29227 Aug '06 - 8:23 
I am also wondering this. I have created a project I would like to test using Visual Studio 2005 (.Net 2.0). It is not working, and I suspect that it is because it is not compatabile with 2.0. Here is the console output I get when running from console (myPerf is a dll built with 2.0)
 

Nperf.Cons -ta=MyPerf.dll -tdfap=System -tdfap=mscorlib
Load tester assembly: MyPerf.dll
System.BadImageFormatException: The format of the file 'MyPerf.dll' is invalid.
File name: "MyPerf.dll"
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, B
oolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Ass
embly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean
stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence security
Evidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at NPerf.Cons.Class1.Main(String[] args)

GeneralRe: Framework .Net 2.0memberWcohen27 Dec '06 - 5:30 
It compiled fine under .NET 2.0 and I had no troubles using it. I have to mention that I don't have .NET 1.0 nor do I have .NET 1.1 installed on my machine.
GeneralExcellentmemberDesmond McCarter23 Jan '06 - 2:40 
This is really good work: something that should have been thought of years ago.
 
Just wondering though - does NPerf have any in-built multi-threading capabilities? i.e. is there a way through the attributes I can muti-thread method calls rather than run them sequencially (without any effort from my end)?
 
Again, very good job.
 
Des.
 
Rgds,
Des.
Generaldownload NPerf - site under maintenancemembernorm7 Apr '05 - 16:53 
hey, broken link!
 
Norman Fung
GeneralRe: download NPerf - site under maintenancememberguillaume_se10 Nov '05 - 2:28 
site alway down, 8 month later...
obviously, there's no pilot on the plane anymore.
 
but you can still use the source files mnetionned on the top of this article.
It compile fine, even under the 2.0 version of the framework
Generalhelp getting startedmembervk21018 Mar '05 - 11:27 
Hi:
looks like it's not able to find the ClassLibrary1.dll, the class to be tested. Can anyone tell me why?
 
NPerf.Cons -ta=ConsoleApplication1.dll -tdfap=ClassLibrary1.dll
 
Load tester assembly: ConsoleApplication1.dll
Load tested assembly: ClassLibrary1.dll
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
at NPerf.Core.PerfTester.LoadTestedTypes(Assembly a) in c:\dev tools\nperf_src\releases\unpackaged\nperf-1.1-release\nperf\src\nperf.core\perftester.cs:line 204
at NPerf.Cons.Class1.Main(String[] args) in C:\Dev Tools\nperf_src\Releases\Unpackaged\nperf-1.1-Release\nperf\src\NPerf.Cons\Class1.cs:line 80
 

Thanks
 
vk
GeneralFinding tested typesmemberling_aus18 Oct '04 - 7:29 
I am very new to NPerf, so please bare with me if my question doesn't make any sense.
Currently to run a test assembly using nperf.cons, I need to specify the name of the test assembly, plus the names of the assemblies that contain the types my test assembly tests.
Since all the assemblies are referenced from the test assembly, can NPerf load all the referenced assemblies at start time and save user the work to enter the assembly names?
 
Ling
GeneralMeasuring the resultsmembersteven_pack11 Oct '04 - 7:14 
The y axis shows log(s). Is this log10?
 
That is, if a test comes out as -2, that is 10^-2=.01 of a second. I.e. 10ms?
GeneralExamplesmemberSteveSlo30 Aug '04 - 4:27 
Could someone point me in the direction of some additional examples (I learn best by example)? I had no problem with the demo, however, when I try to create my own tests, I don't get very far. In particular, I'm trying to create a test to evaluate database access performance.
GeneralPretty darn goodmembersoup19 Jul '04 - 5:19 
Hi there,
 
This is an excellent idea, something I think many software projects could benefit from. 5 stars!
 
Small article correction though: the source code download link was about 750k, not 49k!
 
Big Grin | :-D
 
Simon
QuestionWhy are [PerfTest] methods run twice?memberRjae Easton17 May '04 - 11:49 
Is this a bug? PerfTester.RunTests calls RunTest twice where (testIndex == 0). Given a [PerfTest] that inserts db records, this causes 2 writes where 1 is desired.
 
I have not figured a way to circumvent this. Do you have advise or comment on this situation?
 
Thank you.
 
P.S. I am a big fan of NPerf!
 
Rjae Easton
p: +1.508.898.4691
c: +1.508.369.7339
e: reaston@applanet.com
aim: M1ngSheng
msn: rjae_easton@hotmail.com
Y!: m1ngsheng

AnswerRe: Why are [PerfTest] methods run twice?memberJonathan de Halleux17 May '04 - 12:07 
Test is run twice at the beginning to make sure JIT does not corrupts all the results. I have not found better solution for this.
 
Rjae Easton wrote:
P.S. I am a big fan of NPerf!
 
Thanks Smile | :)
 
Jonathan de Halleux - My Blog - www.dotnetwiki.org -
MbUnit - QuickGraph - NCollection

QuestionSource on dotnetwiki missing code?sussPhilip Nelson10 Mar '04 - 5:17 
I just downloaded the binary from dotnetwiki and it's missing the NPerf.Framework.dll. No problem, I downloaded the source, and it won't compile. It seems a couple of what appears to be delegates are not defined in the source anywhere.
 
PerfTestEventHandler
PerfTestRun
 
Is there more updated source somewhere?
 
Thanks
 
Philip Nelson
AnswerRe: Source on dotnetwiki missing code?memberJonathan de Halleux15 Mar '04 - 20:32 
I'll check this out tonight.
 
Jonathan de Halleux.

www.dotnetwiki.org

GUnit

GeneralRe: Source on dotnetwiki missing code?memberJonathan de Halleux19 Apr '04 - 3:26 
You can download the latest source from the http://mbunit.tigris.org[^] CVS.
 
Jonathan de Halleux - My Blog - www.dotnetwiki.org -
MbUnit - QuickGraph - NCollection

GeneralType comparison problemsussDarin Creason5 Feb '04 - 16:06 
Hello everyone. Thanks for taking the time to write this and sharing it, Jonathan. I have been working with your library today and found what I think is a problem in the type comparison routine.
 
Taken from PerfTester.cs:
 
public void LoadTestedTypes(Assembly a)
{
    if (a==null)
        throw new ArgumentNullException("a");
 
    if (this.testedType.IsInterface)
    {
        foreach(Type t in a.GetExportedTypes())
        {
            if (
                t.GetInterface(this.testedType.ToString())!=null
                && !t.IsAbstract
                )
                this.testedTypes.Add(t);
        }
    }
    else
    {
        foreach(Type t in a.GetExportedTypes())
        {
            if (   t.IsInstanceOfType(TestedType)
                && !t.IsAbstract
                )
                this.testedTypes.Add(t);
        }
    }
}
 
The check for exportable types when the testedType is an interface seems to work okay. The check when it is not doesn't work and I think I know why. The call to IsInstanceOfType is defined by Microsoft as returning "true if the current Type is in the inheritance hierarchy of the object represented by the parameter, or if the current Type is an interface that the object supports. false if neither of these conditions is the case, or if the object is a null reference."
 
Full definition: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclassisinstanceoftypetopic.asp
 
The kind of object being passed to IsInstanceOfType is an object of type Type not an object of the type you actually want to compare. In order to use this method you will need to create an instance of the type you want to compare and pass that in.
 
However, I think the method that you really want to use in this case is IsAssignableFrom. This method takes an object of type Type instead of an actual instance. Furthermore, this method also returns:
 
"true if the parameter and the current Type represent the same type, or if the current Type is in the inheritance hierarchy of the parameter, or if the current Type is an interface that the parameter supports. false if none of these conditions are the case, or if the parameter is a null reference."
 
I think this covers all of the cases that you might be concerned with for your framework. I have included an example to illustrate this.
 
using System;
using System.Reflection;
 
namespace CheckAssignability
{
    public interface IFoo
    {
    }
    
    public class FooBase : IFoo
    {
    }
 
    public class Foo : FooBase
    {
    }
 
    public class Bar
    {
    }
 
    class Class1
    {
        [STAThread]
        static void Main(string[] args)
        {
        
           Foo f = new Foo();
           FooBase fb = new FooBase();
            
           Type fooType = typeof(Foo);
           Type fooBaseType = typeof(FooBase);
           Type ifooType = typeof(IFoo);
           Type barType = typeof(Bar);
 
           Console.WriteLine(String.Format("A Foo is {0} assignable from a Foo.", fooType.IsAssignableFrom(fooType) ? "" : "not"));
           Console.WriteLine(String.Format("A FooBase is {0} assignable from a Foo.", fooBaseType.IsAssignableFrom(fooType) ? "" : "not"));
           Console.WriteLine(String.Format("An IFoo is {0} assignable from a Foo.", ifooType.IsAssignableFrom(fooType) ? "" : "not"));
           Console.WriteLine(String.Format("An IFoo is {0} assignable from a FooBase.", ifooType.IsAssignableFrom(fooBaseType) ? "" : "not"));
           Console.WriteLine(String.Format("An IFoo is {0} assignable from a Bar.", ifooType.IsAssignableFrom(barType) ? "" : "not"));
        }
    }
}
 
Cheers,
 
Darin
GeneralRe: Type comparison problemmemberJonathan de Halleux5 Feb '04 - 21:29 
Thanks, in fact, the loadtypes method looks much simpler now. I will integrate that in the next version.
 
public void LoadTestedTypes(Assembly a)
{
    foreach(Type t in a.GetExportedTypes())
    {
        if (this.testedType.IsAssignableFrom(t) &&!t.IsAbstract )
        {
            this.testedTypes.Add(t);
        }
    }
}

 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralComparisonsmemberCarel Lotz3 Feb '04 - 20:09 
Hi
 
Thanks for the excellent implementation. I have been looking for something of the kind for quite a while. I was wondering whether it is possible to add some kind of comparison feature which would enable you to automatically compare different runs against each other. Much in the same way that you run Unit tests to ensure that your code still performs some basic functions correctly, I am looking to run some kind of performance unit tests to ensure that the code is still performing at least as fast as a certain base-line of acceptable performance.
 
I see that you can store the results in XML and I gather from that you would be able to write some kind of tool to compare results of different runs to see whether performance has increased/decreased? Is there a better way to do this kind of comparison? Can it be built into the framework?
 
Thanks
 
Carel Lotz
GeneralRe: ComparisonsmemberJonathan de Halleux5 Feb '04 - 3:24 
Carel Lotz wrote:
I see that you can store the results in XML and I gather from that you would be able to write some kind of tool to compare results of different runs to see whether performance has increased/decreased? Is there a better way to do this kind of comparison? Can it be built into the framework?
 
I've added this to my "to think about" list. I'll let you know.
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralBlank Graphicsmemberrido28 Jan '04 - 6:11 
Runnning the demos, I only get empy charts.
 
¿why?
 

GeneralRe: Blank GraphicsmemberJonathan de Halleux28 Jan '04 - 6:29 
Could you cut and paste the console ouput ?
Could you try with the latest version available at http://www.dotnetwiki.org[^] ?

 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: Blank Graphicsmemberrussjacmarc21 Jul '04 - 17:40 
I have the same problem. Has a solution for this been posted anywhere?

GeneralIntegrationmemberKeith Farmer27 Jan '04 - 13:03 
With all the talk of integrating with each other, how about integrating with VS.NET? I don't think I'd use NUnit like I do, except for the availability of the add-in.
GeneralRe: IntegrationmemberJonathan de Halleux27 Jan '04 - 20:17 
There's already this project: http://weblogs.asp.net/nunitaddin/[^]
 
The problem with NUnit is the difficulty to add new test attributes to make the framework richer... maybe MUTE .
 
I'm not a add-in (although I would like), Marc ?
 

 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: IntegrationmemberKeith Farmer28 Jan '04 - 10:38 
As I mentioned, I already use the NUnit addin.
 
But I think MUTE + NPerf could work well in that fashion...
GeneralRe: IntegrationmemberJonathan de Halleux28 Jan '04 - 10:55 
Keith Farmer wrote:
But I think MUTE + NPerf could work well in that fashion..
 
Yes, this would be quite an achievement. The more I use NUnit the more I feel I could come up with new attributes... Marc, is it possible to contribute ?
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: IntegrationmemberJonathan de Halleux28 Jan '04 - 11:42 
This is getting interresting... The more I use NUnit, the more I feel it is just the minimum of what you can do using custom attributes/reflection.
 
MUTE seems to be rather inovative and it would be nice to give a big kick in the unit testing world by adding tons of new attributes. Like for each unit test pattern ?
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: IntegrationeditorMarc Clifton1 Feb '04 - 12:07 
My MUTE[^] project considerably advances NUnit. While not currently integrated with VS, that is being worked on as we speak.
 
For the latest version, see the project page.[^].
 
Marc
 
Latest AAL Article
My blog
Join my forum!
GeneralRe: IntegrationmemberKeith Farmer2 Feb '04 - 9:31 
Yeah, tigris has for some reason lost my permissions (I'd originally joined to browse subversion and the like). I think I managed to join the AUT project a couple weeks ago, but now I don't even have basic permissions.

GeneralRe: IntegrationeditorMarc Clifton2 Feb '04 - 10:22 
Yeah, tigris has for some reason lost my permissions (I'd originally joined to browse subversion and the like). I think I managed to join the AUT project a couple weeks ago, but now I don't even have basic permissions.

 
Hi Keith,
 
You're set up as an observer in AUT. If you want, I can revoke that role and you can try joining again.
 
Marc
 
Latest AAL Article
My blog
Join my forum!
GeneralRe: IntegrationmemberKeith Farmer4 Feb '04 - 8:03 
Yeah, I just re-discovered that account, which uses a deprecated account name. What I think has happened is that there are two accounts with the same email, such that logging on via email rather than user name uses the account that doesn't even have permission to view the site help.
 
I don't think changing the role on AUT will help. What's needed, I think, is a site-level database fix. I *think* I emailed the site admin, but the only thing I ever heard back was the observer role for aut being granted.
GeneralRe: tigris troublesmemberKeith Farmer4 Feb '04 - 8:17 
Was that you who just moved "deoradh" to Developer role?
 
The trouble account, btw, is "kfarmer". This is what happens when I log on...
 
Your account does not have the "Start Page - View" permission needed for you to access the page you requested in the tigris.org domain (view your permissions). Either ask the site administrator for more permission, or log in using a different account.
You are currently logged in as kfarmer.
 
Clicking "view your permissions" yields...
Your account does not have the "User - View - Self" permission needed for you to access the page you requested in the tigris.org domain (view your permissions). Either ask the site administrator for more permission, or log in using a different account.
You are currently logged in as kfarmer.
 
Site feedback...
Your account does not have the "Project Content - View" permission needed for you to access the page you requested in the www project (view your permissions). Either ask the project administrator for more permission, or log in using a different account.
You are currently logged in as kfarmer.
 
... you get the idea.
GeneralExcellent!editorMarc Clifton26 Jan '04 - 15:34 
What more can I say?
 
5+++!
 
Marc
 
Latest AAL Article
My blog
Join my forum!
GeneralRe: Excellent!memberPaul Selormey26 Jan '04 - 18:44 
Me too!
Nice work, nice idea - good for me.
 
Best regards,
Paul.

 
Jesus Christ is LOVE! Please tell somebody.
GeneralRe: Excellent!memberJonathan de Halleux26 Jan '04 - 21:09 
Thanks for the support Smile | :)
 
Marc,
 
I've ended up writing this framework while benching up the different sort algorithms. In fact, we could use it to bench sort algorithms Smile | :)
 
Cheers,
Jonathan
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: Excellent!editorMarc Clifton26 Jan '04 - 22:59 
Jonathan de Halleux wrote:
I've ended up writing this framework while benching up the different sort algorithms. In fact, we could use it to bench sort algorithms
 
Sounds great!
 
Marc
 
Latest AAL Article
My blog
Join my forum!
GeneralRe: Excellent!memberJonathan de Halleux27 Jan '04 - 3:04 
I can already tell you that QuickSort is winning the race Smile | :)
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: Excellent!memberDaniel Turini28 Jan '04 - 6:30 
Jonathan de Halleux wrote:
I can already tell you that QuickSort is winning the race
You should also put Radix Sort and Intro Sort to fight.
Maybe we have some new winners this year Smile | :)

 
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier

 
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn

GeneralRe: Excellent!memberJonathan de Halleux28 Jan '04 - 6:49 
I wonder how you implement RadixSort for Object instance ? Don't it work on int only ?
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: Excellent!memberDaniel Turini28 Jan '04 - 7:19 
You can RadixSort on strings, like this shows. It's called Bucket Sort, unfortunately, as Radix Sort is also know as Bucket Sort.
In case of .NET, for an Object, you need a string representation as the "sorting key".
The advantage is that it can sort on O(N+k) time. There are cases where this is much faster than quicksort. Ok, there are cases where this is also worse than quicksort.
That's why I also mentioned IntroSort (just a quicksort hack).

 
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier

 
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn

GeneralRe: Excellent!memberJonathan de Halleux28 Jan '04 - 10:42 
I've also got my ternary search tree that could be used for sorting Smile | :)
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: Excellent!memberJonathan de Halleux27 Jan '04 - 5:13 
Wow, this update was fast!
 
Btw, marc. Do you think it could be possible to integrate NPerf into your unit test framework GUI ? (i'm toooo lazy to wrap a gui). Besides it would be a nice "bonus" feature Smile | :)
 
Jonathan de Halleux.

www.dotnetwiki.org

GeneralRe: Excellent!editorMarc Clifton27 Jan '04 - 6:36 
Jonathan de Halleux wrote:
Wow, this update was fast!
 
I thought you'd appreciate it. I wanted to get your article into the Unit Testing section (which is under Design and Strategy right now--maybe we should have a Unit Testing section under C#, but being under D&S makes it visible in all the forums--pros and cons there too).
 
Jonathan de Halleux wrote:
Do you think it could be possible to integrate NPerf into your unit test framework GUI ? (i'm toooo lazy to wrap a gui).
 
I'm already looking at it. I'm planning on a couple extra tabs in MUTE, one would be the graph output. I'd like to stick with the architecture that I already have for MUTE and extend it with your new attributes and features.
 
There's another article that was submitted today: http://www.codeproject.com/useritems/Best_Unit_Test_Framework.asp[^]
 
and it needs a lot more editing than yours did Smile | :) , but I also like the idea of security and stress testing. Finally, a fellow at Microsoft has been using MUTE and emailed me some changes he made, which include tracking the min/max/avg test times and exporting results to XML to be viewed with IE using XSLT. His latest updates also include caching dependent assemblies so the runner can locate them again later on and some other improvements.
 
So, I've got a lot of work to do, folding in all these great things! But first, I want to put together that article on the different sort algorithms (most likely as a completely new article, rather than editing the current one). For the moment, I'll probably just mention the unit tests briefly, and then when I do the unit testing article, I'll use the sorting algorithms to demonstrate the unit tests (I guess that's sort of backwards, eh?). What do you think of that plan?
 
Marc
 
Latest AAL Article
My blog
Join my forum!
GeneralRe: Excellent!memberJonathan de Halleux27 Jan '04 - 10:27 

Marc Clifton wrote:
I'm already looking at it. I'm planning on a couple extra tabs in MUTE, one would be the graph output. I'd like to stick with the architecture that I already have for MUTE and extend it with your new attributes and features.
 
Nice!
 
Marc Clifton wrote:
I thought you'd appreciate it. I wanted to get your article into the Unit Testing section (which is under Design and Strategy right now--maybe we should have a Unit Testing section under C#, but being under D&S makes it visible in all the forums--pros and cons there too).
 
If you need help, you ask.
 
Marc Clifton wrote:
For the moment, I'll probably just mention the unit tests briefly, and then when I do the unit testing article, I'll use the sorting algorithms to demonstrate the unit tests (I guess that's sort of backwards, eh?). What do you think of that plan?
 
It would be a nice example of interface unit test: suppose that we have the ISorter interface:
interface ISorter
{
   void Sort(IList list);
}
We should be able to write a "generic" test for the ISorter attribute and the framework would look for implementation and test them Smile | :)
 
Here's the NPerf code to benchmark sort algorithms
[PerfTester(typeof(ISorter),10
            ,Description = "Sort Algorithm benchmark"
            ,FeatureDescription="Collection size")]
public class SmallNumberOfElementsTester
{
    private ArrayList list;
    public int CollectionCount(int testIndex)
    {
        int n = 0;
        if (testIndex < 0)
            n=10;
        else
            n = (testIndex+1)*100;
			
        return n;			
    }
 
    [PerfRunDescriptor]
    public double RunDescription(int testIndex)
    {
        return (double)CollectionCount(testIndex);
    }
 
    [PerfSetUp]
    public void SetUp(int testIndex, ISorter sorter)
    {
        Random rnd = new Random();
        this.list = new ArrayList();
        for(int i = 0;i<CollectionCount(testIndex);++i)
            this.list.Add(rnd.Next());
    }
 
    [PerfTest]
    public void Sort(ISorter sorter)
    {
        sorter.Sort(this.list);
    }
 

    [PerfTearDown]
    public void TearDown(ISorter sorter)
    {
        // checking up
	for(int i = 0;i<list.Count-1;++i)
	    if ((int)list[i]>(int)list[i+1])
		throw new Exception("list not sorted");
    }
}
 

 
Jonathan de Halleux.

www.dotnetwiki.org

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 26 Jan 2004
Article Copyright 2004 by Jonathan de Halleux
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid