thankforpie Posted March 6, 2019 Report Share Posted March 6, 2019 javascript (node), c# and c++ have it. It makes the most of single thread (but not only) applications, as it does other things instead of blocking the thread Quote Link to comment Share on other sites More sharing options...
Stan` Posted March 6, 2019 Report Share Posted March 6, 2019 No all our code run synchronously. Node has a special engine in the background to process those commands. Recently they switched to V8 which is the same engine chrome uses. We use Spidermonkey which is used by firefox. So it could be possible in theory, if we upgraded Spidermonkey to the latest version, but would need a complete rewrite of our codebase, with likely no benefit. Quote Link to comment Share on other sites More sharing options...
thankforpie Posted March 6, 2019 Author Report Share Posted March 6, 2019 3 minutes ago, stanislas69 said: No all our code run synchronously. Node has a special engine in the background to process those commands. Recently they switched to V8 which is the same engine chrome uses. We use Spidermonkey which is used by firefox. So it could be possible in theory, if we upgraded Spidermonkey to the latest version, but would need a complete rewrite of our codebase, with likely no benefit. oh well thats bad, im using c# now, its faster than node, can make more, can be multithreaded and asynchronous, so i can have like few threads all of them being asynchronous Quote Link to comment Share on other sites More sharing options...
Stan` Posted March 6, 2019 Report Share Posted March 6, 2019 We have threads though. Not everything is running in the same thread. But basically all the JavaScript, save for the AI runs in the same thread. Quote Link to comment Share on other sites More sharing options...
Itms Posted March 7, 2019 Report Share Posted March 7, 2019 The AI is not actually threaded, it is mostly async, to be easily threadable, but the latter needs to be done. Some other parts of the code (such as the pathfinder) are also properly designed to be threaded eventually, but they are not yet. We need someone to implement the threading, we do not need yet to make more parts of the code asynchronous. Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted March 7, 2019 Report Share Posted March 7, 2019 <offtopic> Actually 0A.D. uses async/await during its development. For example some of my patches are waiting for other patches that are waiting for review (promises!). At the same time I may create async patches that are not related to the previous ones. </offtopic> 2 Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted March 7, 2019 Report Share Posted March 7, 2019 21 hours ago, thankforpie said: oh well thats bad, im using c# now, its faster than node, can make more, can be multithreaded and asynchronous, so i can have like few threads all of them being asynchronous Multithreading isn't a silver bullet. It requires a lot of stuff: you need to synchronise different threads, you need to pass data between threads and you need code it without races. It costs a lot of time for complex projects, so as Stan said we may not have a visible benefit at all. Or its cost would be really huge. So it should be analysed before introducing the multithreading in all stuff. 1 1 Quote Link to comment Share on other sites More sharing options...
thankforpie Posted March 9, 2019 Author Report Share Posted March 9, 2019 On 3/6/2019 at 9:18 PM, stanislas69 said: No all our code run synchronously. Node has a special engine in the background to process those commands. Recently they switched to V8 which is the same engine chrome uses. We use Spidermonkey which is used by firefox. So it could be possible in theory, if we upgraded Spidermonkey to the latest version, but would need a complete rewrite of our codebase, with likely no benefit. Async await lets you perform I/O bound operations like talking with database or reading file from disk in the same time that it lets you perform mathematical calculations. afaik 0 a.d. pathfinder consists of loads of heavy mathematical calculations right? honestly i didnt manage to make use of it yet in my code because i dont perform any heavy mathematic methods in my projects, and when I do, i dont use anything I/O bound. I have to study about this mor,e maybe its more useful than I think Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.