1 // Copyright (C) 2004-2014 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
20 #include <testsuite_performance.h>
23 test_pair(const std::string
& s
, const std::string
& f
, int n
)
25 std::string::size_type sz
= 0;
27 for (int i
= 0; i
< n
; ++i
)
34 using namespace __gnu_test
;
37 resource_counter resource
;
39 const unsigned int iterations
= 2000000;
42 s
= "aabbaabbaaxd adbffdadgaxaabbbddhatyaaaabbbaabbaabbcsy";
44 start_counters(time
, resource
);
45 test_pair(s
, f
, iterations
);
46 stop_counters(time
, resource
);
47 report_performance(__FILE__
, "1", time
, resource
);
48 clear_counters(time
, resource
);
51 start_counters(time
, resource
);
52 test_pair(s
, f
, iterations
);
53 stop_counters(time
, resource
);
54 report_performance(__FILE__
, "2", time
, resource
);
55 clear_counters(time
, resource
);
58 start_counters(time
, resource
);
59 test_pair(s
, f
, iterations
);
60 stop_counters(time
, resource
);
61 report_performance(__FILE__
, "3", time
, resource
);
62 clear_counters(time
, resource
);
64 s
= "dhruv is a very very good boy ;-)";
66 start_counters(time
, resource
);
67 test_pair(s
, f
, iterations
);
68 stop_counters(time
, resource
);
69 report_performance(__FILE__
, "4", time
, resource
);
70 clear_counters(time
, resource
);
73 start_counters(time
, resource
);
74 test_pair(s
, f
, iterations
);
75 stop_counters(time
, resource
);
76 report_performance(__FILE__
, "5", time
, resource
);
77 clear_counters(time
, resource
);
79 f
= "extra irritating";
80 start_counters(time
, resource
);
81 test_pair(s
, f
, iterations
);
82 stop_counters(time
, resource
);
83 report_performance(__FILE__
, "6", time
, resource
);
84 clear_counters(time
, resource
);
86 s
= "this is a very this is a very this is a verty this is a very "
87 "this is a very long sentence";
88 f
= "this is a very long sentence";
89 start_counters(time
, resource
);
90 test_pair(s
, f
, iterations
);
91 stop_counters(time
, resource
);
92 report_performance(__FILE__
, "7", time
, resource
);
93 clear_counters(time
, resource
);