On 04/25/2012 12:44 AM, ext Mike Zraly wrote: > On Mon, Apr 23, 2012 at 7:57 PM, Lincoln Ramsay > <[email protected] <mailto:[email protected]>> wrote: > I'm a little concerned about performance during shutdown if there are a > large number (say 100 or more) of QLoggingCategory objects listed in > _registeredCategories though, as each each call to QList::removeOne will > do a linear scan for the address to remove. In the worst case where > QLoggingCategory objects are destructed in reverse order of their being > added to _registeredCategories the time for scanning will grow as > O(n**2). That can be addressed later if it turns out to be a real > problem in practice.
With the current setup, this won't be a problem because QLoggingPrivate will be destructed before any of the category objects are. > > 2. Get rid of the QT_LOG_CATEGORY macro and expose QLogging category > > directly. > > Yeah... what I said before. > > I think there is merit in this idea. We may have to be a little careful > since people have already started using this code (ie. I'd like to keep > source compatibility) but I think this is worth a try. > > > Fair enough. But if you must keep QT_LOG_CATEGORY redefine it so that > you can still pass QLoggingCategory references or addresses to qCDebug. > The key to that is using QT_LOG_CATEGORY's first argument as the > generated variable name, then exposing whatever namespace it is in to > the code that calls qCDebug. I see three options: > > 1. Skip the namespace altogether, rely on the static keyword to limit > the variable's scope. > 2. Use an unnamed namespace for the same effect. > 3. Add using directives to expose the QtLogger::QLoggingCategories > namespace. > > Options 1 or 2 seem the simplest to me, but there may be reasons for > using the namespace that I have overlooked. I put some of this into a bug report. If you would like to comment further on it, feel free to do so. https://bugreports.qt-project.org/browse/QTBUG-25530 -- Lincoln Ramsay - Senior Software Engineer Qt Development Frameworks, Nokia - http://qt.nokia.com/ _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
