Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to not allowing the user to kill a process from Task Manager Pin
fjdiewornncalwe16-Jan-11 16:46
professionalfjdiewornncalwe16-Jan-11 16:46 
Questionsome questions about Chart control Pin
Erdinc2716-Jan-11 2:17
Erdinc2716-Jan-11 2:17 
QuestionStatic label in taskbar Pin
WritinCode15-Jan-11 19:35
WritinCode15-Jan-11 19:35 
AnswerRe: Static label in taskbar Pin
Eddy Vluggen16-Jan-11 10:39
professionalEddy Vluggen16-Jan-11 10:39 
Questioncant play sound from source using MediaElement Pin
igalep13215-Jan-11 12:10
igalep13215-Jan-11 12:10 
AnswerRe: cant play sound from source using MediaElement [modified] Pin
RaviRanjanKr15-Jan-11 18:23
professionalRaviRanjanKr15-Jan-11 18:23 
GeneralRe: cant play sound from source using MediaElement Pin
igalep13216-Jan-11 11:16
igalep13216-Jan-11 11:16 
GeneralRe: cant play sound from source using MediaElement Pin
RaviRanjanKr16-Jan-11 17:57
professionalRaviRanjanKr16-Jan-11 17:57 
QuestionDo people know about LINQ expression trees for super fast reflection? Pin
SledgeHammer0115-Jan-11 9:15
SledgeHammer0115-Jan-11 9:15 
AnswerRe: Do people know about LINQ expression trees for super fast reflection? PinPopular
Pete O'Hanlon15-Jan-11 10:26
mvePete O'Hanlon15-Jan-11 10:26 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
SledgeHammer0115-Jan-11 11:23
SledgeHammer0115-Jan-11 11:23 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
N a v a n e e t h16-Jan-11 4:51
N a v a n e e t h16-Jan-11 4:51 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
Pete O'Hanlon16-Jan-11 5:06
mvePete O'Hanlon16-Jan-11 5:06 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
N a v a n e e t h16-Jan-11 5:15
N a v a n e e t h16-Jan-11 5:15 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
Pete O'Hanlon16-Jan-11 9:12
mvePete O'Hanlon16-Jan-11 9:12 
AnswerAll of this post is plagiarised (except for the smiley...) Pin
Keith Barrow15-Jan-11 11:24
professionalKeith Barrow15-Jan-11 11:24 
AnswerRe: Do people know about LINQ expression trees for super fast reflection? Pin
PIEBALDconsult15-Jan-11 14:10
mvePIEBALDconsult15-Jan-11 14:10 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? [modified] Pin
SledgeHammer0115-Jan-11 15:16
SledgeHammer0115-Jan-11 15:16 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
SledgeHammer0115-Jan-11 15:22
SledgeHammer0115-Jan-11 15:22 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
PIEBALDconsult16-Jan-11 5:11
mvePIEBALDconsult16-Jan-11 5:11 
AnswerRe: Do people know about LINQ expression trees for super fast reflection? Pin
Dan Mos16-Jan-11 3:00
Dan Mos16-Jan-11 3:00 
AnswerRe: Do people know about LINQ expression trees for super fast reflection? Pin
N a v a n e e t h16-Jan-11 5:14
N a v a n e e t h16-Jan-11 5:14 
SledgeHammer01 wrote:
for (i = 0; i < 1000000; i++)
{
// get property 1 million times through reflection
}

that took 4.4 seconds on my machine. I unwound the loop a bit and got it down to 2.1 seconds.


How are you making the calls? MethodInfo.Invoke() ? If yes, then this method is slow. Try creating a delegate from MethodInfo using Delegate.CreateDelegate method and use that for invocation. You should get results closer with expression trees. Make sure you don't do delegate creation on each iteration.

Expression trees are faster because they gets translated into IL when you call Compile() on it.

Smile | :)
Best wishes,
Navaneeth

GeneralRe: Do people know about LINQ expression trees for super fast reflection? Pin
SledgeHammer0116-Jan-11 7:14
SledgeHammer0116-Jan-11 7:14 
AnswerRe: Do people know about LINQ expression trees for super fast reflection? Pin
jschell17-Jan-11 8:22
jschell17-Jan-11 8:22 
GeneralRe: Do people know about LINQ expression trees for super fast reflection? [modified] Pin
SledgeHammer0118-Jan-11 4:55
SledgeHammer0118-Jan-11 4:55 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.