stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-492) std::string::operator+=() slow
Date Mon, 24 Sep 2007 22:43:50 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530008
] 

Martin Sebor commented on STDCXX-492:
-------------------------------------

Woohoo! The numbers look awesome!

As for how to enter different overloads into a ChangeLog, I don't have a good answer for you.
I have had the occasional need to distinguish between two or more overloads of the same function
in the past but so far I've always decided to ignore this detail. It might be worthwhile to
look into it some more and look at some other C++ projects' ChangeLogs to see how they deal
with it.

The one change I did make to the format of your ChangeLog is capitalize the first letter of
every sentence for consistency with the most of the rest of our ChangeLogs.

> std::string::operator+=() slow
> ------------------------------
>
>                 Key: STDCXX-492
>                 URL: https://issues.apache.org/jira/browse/STDCXX-492
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 21. Strings
>    Affects Versions: 4.1.3
>         Environment: gcc 4.1.2 on Linux/x86_64
>            Reporter: Mark Brown
>            Assignee: Travis Vitek
>             Fix For: 4.2
>
>         Attachments: 21.string.append.perf.cpp, string.patch
>
>
> Comparing overloads of string::operator+=() in stdcxx with the same functions in gcc
4.1.2, stdcxx is up to twice slower than gcc:
> $ time ./op_plus_equal-stdcxx 100000000 0
> real    0m2.241s
> user    0m1.932s
> sys     0m0.204s
> $ time ./op_plus_equal-stdcxx 100000000 1
> real    0m2.540s
> user    0m2.344s
> sys     0m0.196s
> $ time ./op_plus_equal-stdcxx 100000000 2
> real    0m1.492s
> user    0m1.308s
> sys     0m0.184s
> $ time ./op_plus_equal-gcc 100000000 0
> real    0m0.883s
> user    0m0.728s
> sys     0m0.156s
> $ time ./op_plus_equal-gcc 100000000 1
> real    0m1.589s
> user    0m1.424s
> sys     0m0.168s
> $ time ./op_plus_equal-gcc 100000000 2
> real    0m1.131s
> user    0m0.976s
> sys     0m0.156s
> #include <cassert>
> #include <cstdlib>
> #include <string>
> int main (int argc, char *argv[])
> {
>     const int N = argc < 2 ? 1 : std::atoi (argv [1]);
>     const int op = argc < 3 ? 0 : std::atoi (argv [2]);
>     std::string str;
>     const std::string x ("x");
>     if (op == 0) {
>         for (int i = 0; i < N; ++i)
>             str += 'x';
>     } else if (op == 1) {
>         for (int i = 0; i < N; ++i)
>             str += "x";
>     } else {
>         for (int i = 0; i < N; ++i)
>             str += x;
>     }
>     assert (str.size () == std::size_t (N));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message