This patch improves the performance of my test by about 20%

It removes a lot of unnecessary string creation, as ...::check(...) is called for every CHECK_APR_SUCCESS(), and they are very frequent.

[At this point it seems I have come to the end of the "low hanging fruit" though. I'll have to do some real work to get performance wins]

Index: cpp/lib/common/sys/apr/APRBase.h
===================================================================
--- cpp/lib/common/sys/apr/APRBase.h    (revision 482153)
+++ cpp/lib/common/sys/apr/APRBase.h    (working copy)
@@ -52,7 +52,7 @@
    };

//this is also a convenient place for a helper function for error checking: - void check(apr_status_t status, const std::string& file, const int line);
+    void check(apr_status_t status, const char* file, const int line);
    std::string get_desc(apr_status_t status);

#define CHECK_APR_SUCCESS(A) qpid::sys::check(A, __FILE__, __LINE__);
Index: cpp/lib/common/sys/apr/APRBase.cpp
===================================================================
--- cpp/lib/common/sys/apr/APRBase.cpp  (revision 482153)
+++ cpp/lib/common/sys/apr/APRBase.cpp  (working copy)
@@ -82,7 +82,7 @@
    getInstance()->_decrement();
}

-void qpid::sys::check(apr_status_t status, const std::string& file, const int line){ +void qpid::sys::check(apr_status_t status, const char* file, const int line){
    if (status != APR_SUCCESS){
        const int size = 50;
        char tmp[size];

Reply via email to