Sébastien Lorion <[EMAIL PROTECTED]> wrote:

> Ok, makes sense... But the question of Frans then remains unanswered.
> Without measuring, I would also have guessed that the generic version
> would be faster.

The cost differential for value types is even bigger. Same test program
as last time, only Public and Private are struct rather than class:

Activator.Create(typeof(Public))   :  0.108 sec with 1000000 reps
Activator.Create<Public>()         :  0.180 sec with 1000000 reps
Activator.Create(typeof(Private))  :  2.167 sec with 1000000 reps
Activator.Create<Private>()        :  0.170 sec with 1000000 reps

I will say that it looks like Activator.Create<T>() could do with some
optimization.

-- Barry

-- 
http://barrkel.blogspot.com/

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to