This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch: basic_string.tcc


Oops, forgot the file!


On Tue, 2004-07-20 at 16:17, Dhruv Matani wrote:
> Hi,
> 	This patch is basically an optimization for string::rfind(), and
> string::find_first_of(). It attempts to use different algorithms for
> either functions to speed up the operations of the functions in various
> situations. What I have done for find_first_of() is that there is a
> threshold(Paolo pointed out that the function will perform badly when
> the string passed as a parameter is >> *this, or when the string is too
> large, and the table build-up time is >> the normal case) of 128. Only
> if the string passed is <= 128 then will the optimized algorithm kick
> in. Else, the normal algorithm will be used.
> 
> Also, I have one doubt: There is a line such as this:
> 
> if (sizeof(char) <= 8 && (some other run-time condition))
> {
> 
> }
> else
> {
> 
> }
> 
> Now, suppose that sizeof(char) > 8, will the optimizer eliminate the if
> block completely?
> 
> Also, attached are test-cases used for measuring the timing of either of
> the functions before and after applying the patch. The file output.txt
> contains the timings reported by the above 2 tests before and after the
> application of the patch.
> 
> Tested x86-Linux.
> 
> However, these 2 seemingly unrelated tests are failing on the current
> cvs version:
> 
> FAIL: 21_strings/basic_string/inserters_extractors/pod/10081-in.cc (test
> for excess errors)
> WARNING: 21_strings/basic_string/inserters_extractors/pod/10081-in.cc
> compilation failed to produce executable
> FAIL: 21_strings/basic_string/inserters_extractors/pod/10081-out.cc
> (test for excess errors)
> WARNING: 21_strings/basic_string/inserters_extractors/pod/10081-out.cc
> compilation failed to produce executable
> 
-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/

template<typename Signature>
  class CustomSignature : public Signature
{ };

Attachment: outputs.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]