performance - Raising an Event in .net - perfomance implications -


throwing exception costly in terms of writing performance code. raising event? hence theoretical querstion .net clr crowd:

memory implications concerning raising event 1 subscriber? 1 000 000 subscribers? how calculate these implications? raising 1 event euqal calling member method of (the otherwise handler) subscriber directly?

"raising event" means "calling delegate" - potentially multicast delegate many invocations in list. each of these pretty cheap... not more direct method call usually, although there situations more expensive. (iirc, call delegate has been created via interface method more expensive.)

i recommend write natural code start with, , test see if performs enough. can't think of quicker way call bunch of subscriber methods. suspect it's cheap iterating on list of interface implementations , calling interface method on each, , may cheaper in situations.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -