Difference between revisions of "Creating Multithreaded Skyrim Mods Part 3 - Callbacks"

no edit summary
imported>Chesko
imported>Chesko
Line 371: Line 371:


* If you need to perform a set of actions that are not all the same, the Thread Manager might not be best for you. You may want to create different thread base scripts purpose-built for your various tasks and then call their get_async() functions directly, blocking on <code>queued()</code> until they're available. You can still run many different tasks concurrently this way, even if they're not the same.
* If you need to perform a set of actions that are not all the same, the Thread Manager might not be best for you. You may want to create different thread base scripts purpose-built for your various tasks and then call their get_async() functions directly, blocking on <code>queued()</code> until they're available. You can still run many different tasks concurrently this way, even if they're not the same.


== Playing the Example Plugin ==
== Playing the Example Plugin ==
Line 387: Line 388:
* '''20 Threads:''' Avg. 0.5 seconds to complete
* '''20 Threads:''' Avg. 0.5 seconds to complete


This could be due to the fact that actors are more "expensive" to place than, say, a Static. In another mod, I saw that using 30 threads reduced my object placement time from 8.5 seconds to less than 1 on average. Obviously, profiling your script is critical to determine if your unique application would benefit the most from more or less threads (or threading at all).
Profiling your script is critical to determine if your unique application would benefit the most from more or less threads (or threading at all).


Your experience and times may differ based on your current load order and system performance. Give it a try and see what results you obtain.
Your experience and times may differ based on your current load order and system performance. Give it a try and see what results you obtain.
Anonymous user