multithreading - Using multi-threading to speed up .NET reflection -


My PC has a dual core CPU and I was thinking - if it is possible to reduce net reflection twice, So I start processing in two threads.

By "processing" I mean the following:

1. Assembly loading 2. It is going to be all kind of outside (.GetTypes ()) 3. Processed these types 4. Examine these types of methods for methods etc.

If yes - what would be the best (performance-wise) strategy:

  1. Load all the assemblies in one thread, then process metainfo in a two concurent thread < / Li>
  2. Each assembly load and process in your assembly

to keep in mind There are some things to do:

  • Starting a new thread is expensive, so if the work is small it may be prohibited to remain upper thaw Instead of using the pool to start your threads, thread pool ensures that thread again to make the best use of its capabilities should be used. However, launching multiple tasks in a short time does not produce the best results with the current thread pool implementation.

  • Since your specific task involves some I / O, which is probably the most expensive part of the operation. Forgetting many threads to wait for I / O, it can not perform better. You can not really tell until you can measure it.

  • If you are data stored in a shared repository or output on file / screen, then you have to synchronize it around. This clearly reduces concurrency.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -