4

I am trying out Windsor 3.0 to see if we can upgrade.

The following console application

var t = DateTime.Now;
var container = new WindsorContainer();
Debug.WriteLine("Created in " + (DateTime.Now - t).TotalMilliseconds);

Takes 5421.875ms (consistently above 5000ms) to create the WindsorContainer.

Any suggestions to decrease this creation time?

Sebastian Good
  • 6,310
  • 2
  • 33
  • 57
Jeff
  • 35,755
  • 15
  • 108
  • 220
  • I would be looking at your TaskManager to determine what is using your system's resources ...5.5 seconds to instance anything raises suspicion of some resource issue (e.g. memory leak) ... – IAbstract Sep 05 '11 at 02:59
  • This is a simple console application. There is no memory leak. There is no contention in the Task Manager. This appears to be an issue introduced into the DefaultKernel (or some sub-system thereof) of Windsor 3. The issue is not present in Windsor 2.5.2. – Jeff Sep 05 '11 at 03:02
  • oh well, worth a shot. What version of .Net are you using? – IAbstract Sep 05 '11 at 03:36
  • 1
    Ha, that's interesting. I just ran it myself, not believing your numbers, but I'm getting over 3000ms myself (BTW - you probably want to be using `Stopwatch` rather than `DateTime` here). Do report this to the issue tracker. – Krzysztof Kozmic Sep 05 '11 at 05:04
  • Anyone have further suggestions please? I've cut it down to 250ms x 6...and although 1.5 seconds doesn't seem like a lot, to a user waiting for the UI to come up, it seems like ages. – Jeff Sep 09 '11 at 15:47

2 Answers2

3

The source of this behaviour is initialisation of performance counters.

Starting with beta 2 (currently in trunk) performance counters will be off by default so that performance hit should go away.

Krzysztof Kozmic
  • 27,267
  • 12
  • 73
  • 115
1

How can I improve Windsor 3.0 performance?

In this case:

  • Make sure you have the PDBs of Castle.Windsor and Castle.Core
  • Get the sources.
  • Put a breakpoint in the instantiation of WindsorContainer
  • Debug it step by step until you find the source of the issue.
  • Fix the issue
  • Submit a pull request.

Or use some profiler like dotTrace to find the cause.

Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
  • Mauricio: I'm happy to contribute to the Castle project as much as time permits and I appreciate everything the developers of Windsor do...however this is not a case where I have time to fix this bug....and suggesting I do so is not really productive to the purpose of this question. – Jeff Sep 05 '11 at 04:00
  • 1
    I guess I would be better off submitting a bug report instead of posting this question on SO... – Jeff Sep 05 '11 at 04:02
  • @JeffN825: you asked how to improve Windsor 3.0 performance and that's what I'm answering here. How can answering your question precisely be "not productive"? – Mauricio Scheffer Sep 05 '11 at 05:27
  • Actually, the question was edited by another user to the current title. The title of my question was simply "Windsor 3.0 Performance"...and I was looking for information as to why this problem exists. That said...it was my own fault for not posting this simply as a bug on issue tracker....and as such, it's really my question itself that's not productive... – Jeff Sep 05 '11 at 05:40