Strict Standards: Redefining already defined constructor for class wpdb in /www/htdocs/w006f36b/wp-includes/wp-db.php on line 49

Deprecated: Assigning the return value of new by reference is deprecated in /www/htdocs/w006f36b/wp-includes/cache.php on line 35

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /www/htdocs/w006f36b/wp-includes/cache.php on line 400

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 534

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 553

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 649

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /www/htdocs/w006f36b/wp-includes/classes.php on line 674

Deprecated: Assigning the return value of new by reference is deprecated in /www/htdocs/w006f36b/wp-includes/query.php on line 15

Deprecated: Assigning the return value of new by reference is deprecated in /www/htdocs/w006f36b/wp-includes/theme.php on line 505
MauriceK, caught between dev and drums » scaring surprises…

February 20, 2007

scaring surprises…

Category: Development — kaldor @ 8:36 pm

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /www/htdocs/w006f36b/wp-includes/formatting.php on line 76

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /www/htdocs/w006f36b/wp-includes/formatting.php on line 83

While I was continuing work on the function profiler I talked about earlier, I started coding a small application, which should visualize some results. I thought I encountered a bug in the profiler itself, so trying to isolate the problem directed me to a container issue.

The app is written in Qt, and it uses QMap quiet heavily to store data and have fast access to some elements. I thought there might be some problems with templates then, because the output repeated itself again and again, so I wrote a small testapp like this:

int main(int, char**)
{
    printf("App:mainn");
    QMap map;
    map[12] = 4;
    map.clear();
    return 0;
}

Very short app, isn’t it? ;) It inserts one element and clears the map afterwards. So what is your guess on how many functions are getting called? 3? Of course not. 10? Still more. It is 40 function calls including the main itself.

I was heavily shocked and thought that QMap is much too overheaded. But after a short talk to a friend, he suggested that I should try out the STL being included in the Platform SDK. So simply changing the app to

int main(int, char**)
{
    printf("App:mainn");
    std::map map2;
    map2[12] = 4;
    map2.clear();
    return 0;
}

resulted in 249 function calls. This is even more scary and now I am happy that I decided to use Qt for data storage :)

For the ones of you, who are interested in the exact functions, I attached two text files, which show the calls made during that 5 lines of code.

My guess is, that the actual function call count gets much reduced in non-profiling mode, as inline functions are not inlined in this situation, but still it is impressive and it gives you a good hint, that you should be careful which functions you call or which data types you want to use blindly.

Qt Call History

STL Call History

No Comments »

No comments yet.

RSS feed for comments on this post. | TrackBack URI

Leave a comment

XHTML ( You can use these tags):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .