Sign in to follow this  

[.net] MultiCast Delegate performance

This topic is 3666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, At the moment I'm working on an user interface with Lua scripting. I've managed to register and send events to the scripts. This relies on the use of delegates, as one could expect. Each registered handler is chained with the previous existing handler for that event. Once needed, the event is fired, thus invoking all handlers sequentially. I've grown concerned about execution speed, and I've considered other options, such as dynamic code generation; creating a method on the fly which includes calling directly to the delegate targets (I assume I'll manage to extract the classes Lua generates at runtime). Instead of having many invokes, I would only have one, which would take care of the rest of the calls. Since I expect a lot of handlers to be invoked, I thought this could help. Do you think this might improve performance, or it's just going to make my life harder? Sounds like a feasible option, or there are better methods you could shed a light on? Thanks in advance.

Share this post


Link to post
Share on other sites
Quote:

Do you think this might improve performance, or it's just going to make my life harder?


Probably both.

Really, just take care in making that interface nice and clean (so you can swap the implementation out later) and go with the easy way for now. If it becomes a problem, investigate solutions then.

Share this post


Link to post
Share on other sites

This topic is 3666 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this