Re: Bad news, many errors on linux
Eric Sunshine <[email protected]>
| Newsgroups | gmane.comp.graphics.crystalspace.devel |
|---|---|
| Message-ID | <CAPig+cRKZfr96urxyG1isAifg7z8Rvq1hejRAk8vpWiwd65i+A@mail.gmail.com> |
It is important to keep in mind that the CS event system is driven by the hosting program[1], and thus events are dispatched from the queue only as frequently as the hosting program chooses. The hosting program can even suspend processing of the queue, therefore there is no guarantee that messages sent via the event queue between plugins will be delivered in a timely fashion. The event system does not promise on-time delivery. This may or may not matter for the type of usage you have in mind, but should be taken into consideration. Footnotes[5]: [1] By "driven by the hosting program", I mean that the program in which CS is embedded is responsible for invoking iEventQueue::Process() periodically to "run" the CS engine. This is by design; it is not an accident. In many cases, the queue is processed by csDefaultRunLoop(), thus events get dispatched frequently, but this is not guaranteed to be so. csDefaultRunLoop() is just that: a _default_ implementation of a run-loop for "running" CS. In that role, it may or may not be suitable for any given program embedding CS, and programs are encouraged to shun csDefaultRunLoop() and instead invoke iEventQueue::Process() manually if the behavior or lack-of-flexibility of csDefaultRunLoop() is unsuitable[2]. [2] By "unsuitable", I mean that the generic csDefaultRunLoop() implementation does not, within CS's limited purview[3], know how to interact with native facilities of the host system or application framework, nor does it have knowledge about how the hosting program expects to employ CS[4]. [3] Mac OS X's Cocoa framework is a canonical example. Cocoa supplies its own application run-loop which implements the many functionalities common to all OSX applications. "Running" CS is just one of the very many responsibilities of the Cocoa run-loop. iOS for iPhone, iPod, and iPad is similarly burdened. For Cocoa, CS does implement a specially customized csDefaultRunLoop() which works properly in conjunction with Cocoa's own run-loop, but even this implementation may not be suitable[4] for all applications due to its inflexibility. [4] csDefaultRunLoop() is intentionally simple-minded, assuming that it is being employed by high-framerate, fast-paced action games. However, not every program is an action game, hence not every program needs to "run" CS as fast-as-possible. For such programs, it may be more resource-economical to "run" CS by processing its event queue only when needed. The canonical example is an editor built with platform-native toolkits, in which one or a few CS "views" display some 3D content. These views may need to be updated only in response to some user action, or in response to the change of an attribute in some native control which would impact the 3D view. A turned-based game, in which one or more CS 3D views are hosted in a platform-native application is another good example for which CS may be "run" only at infrequent intervals. [5] This email badly abuses footnotes. -- ES On Fri, Jun 29, 2012 at 7:35 AM, Christian Van Brussel <[email protected]> wrote: >> Also I have experienced in the >> past that >> the event system performance goes down considerably if you have many event >> handlers >> registered to it. > > The event queue is using several hash data structures, hence with an > access of the objects with a complexity of a priori O(log n). > > One way to deal with that may therefore to have several different event > queues, eg each one dedicated to a specific domain. > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Crystal-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/crystal-develop ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/