Re: [Boost-users] Boost-users Digest, Vol 3709, Issue 1

Hi Gennadiy,
Yes I would like to know how I need to write my own main in this case?
Also I was wondering if there is any workaround that was found other than re-writing the main?
Thanks,
Deepa
Here is what I am trying to do, may not be the best way, but trying to re-run the test suite ts1 - 3 consecutive times to test for repeatability:
bool init_unit_test_suite(int argc, char **argv)
{
test_suite* ts1 = BOOST_TEST_SUITE( "SKUResourcesTestSuite" );
ts1->add( BOOST_TEST_CASE(&TestCase1) );
ts1->add( BOOST_TEST_CASE(&TestCase2) );
framework::master_test_suite().add( ts1 );
for(int i = 0;i < 3;i++)
{
framework::master_test_suite().add( ts1 );
}
return true;
}
Deepa S
Wanted to check if there was any resolution to the error indicated in this post: http://lists.boost.org/boost-users/2010/06/59564.php
I am running into a similar issue and would like to know how to resolve it.
What exactly is the issue?
Do you want to write your own main?
Gennadiy
On Monday, February 10, 2014 10:30 PM, "boost-users-request@lists.boost.org"
Wanted to check if there was any resolution to the error indicated in this post: http://lists.boost.org/boost-users/2010/06/59564.php
I am running into a similar issue and would like to know how to resolve it.
What exactly is the issue?
Do you want to write your own main?
Gennadiy
------------------------------
Message: 2
Date: Mon, 10 Feb 2014 09:18:20 +0100
From: Adam Romanek
Hi!
Recently I've been trying to improve the performance of a code that makes heavy use of std::string (lots of constructions and destructions). My first thought was to use boost::container::string as it does not use reference-counting and uses small-string optimization, so it should be a perfect replacement for std::string when it comes to performance.
Right... But the problem is that switching to boost::container::string only made things worse in the general case. I wrote "in the general case" because when strings to be held are small and SSO may be applied then boost::container::string outperforms std::string considerably. However, in the general case constructing boost::container::string from a C string is significantly slower than constructing std::string.
My investigation showed that std::string uses memcpy to copy the C string into its buffer while boost::container::string does not. The memcpy comes from std::char_traits::copy so maybe boost::container::string could use it too? I guess the rest of operations from std::char_traits (find, move, assign etc.) could be utilized too as std::char_traits has been carefully crafted with performance in mind.
Should I create a ticket for this issue?
Yes, please. I'm slowly trying to benchmark and improve Boost.Container
performance, I haven't started optimizing basic_string so your ticket
could be a good start point.
In a quick inspection I see that the constructor is dispatched to
basic_string::assign(It, It) and that assignment is not optimized at
all. I should definitely write a assignment function that dispatches to
std::char_traits::copy, as it could be used to optimize several member
functions.
Best,
Ion
------------------------------
Message: 4
Date: Mon, 10 Feb 2014 12:29:39 +0200
From: Adi Shavit

Deepa S
Yes I would like to know how I need to write my own main in this case?
Also I was wondering if there is any workaround that was found other than re-writing the main?
Here is what I am trying to do, may not be the best way, but trying to re- run the test suite ts1 - 3 consecutive times to test for repeatability:
bool init_unit_test_suite(int argc, char **argv) { test_suite* ts1 = BOOST_TEST_SUITE( "SKUResourcesTestSuite" ); ts1->add( BOOST_TEST_CASE(&TestCase1) ); ts1->add( BOOST_TEST_CASE(&TestCase2) ); framework::master_test_suite().add( ts1 ); for(int i = 0;i < 3;i++) { framework::master_test_suite().add( ts1 ); } return true; }
There is nothing particularly wrong with this approach. It really depends on what exactly you want to test. You can also just make a test case which invokes some other function in a loop or you can run the test module in a loop from outside. Gennadiy
participants (2)
-
Deepa S
-
Gennadiy Rozental