I'm sorry, I appear to have wasted my time and yours. When you asked for construction metrics I had assumed you meant for your implementation. With your current scheme there would be no way to avoid the cost of instantiating std::basic_stringbuf, as it's not a templated parameter.


No it is still helpful. I threw together the CVS stuff in a few hours to keep the conversation going and getting it to work and getting the API right were the priorities. Deriving log4cxx::basic_logstreambuf from std::basic_stringbuf was expedient to get things functional, but apparently std::basic_stringbuf has a significant fixed cost (at least in GCC's implementation).


I can't work on this today, but the following steps would hopefully get the CVS implementation performance close to yours for the no logging case:

1. Change the base class for logstreambuf to std::basic_streambuf and comment out the call to logger->log in logstreambuf::sync.
2. Run the no logging benchmark, hopefully it has dropped to near your implementations performance
3. Add a std::vector<Elem> member to logstreambuf
4. Run the no logging benchmark again. Hopefully, the incremental cost is small (if not then the vector constructor is doing some allocation). If large, then change the std::vector<Elem> to a Elem* and rerun.
5. Add logstreambuf::str(), uncomment the logger->log statement and implement the basic_streambuf virtual functions.
6. Test no-logging performance and see if logging works again


If you could do any of these tasks and report the results, it would be helpful.



Reply via email to