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: Regex instantiation


On Thu, Jan 9, 2014 at 1:45 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> It looks strange, I seem to see the same code (with "extern template") in
> the headers and in src/, whereas I don't expect "extern" in src/.

Oops thank you, it's a silly mistake.

> We would have saved quite a bit using pointers as iterators for vector,
> string, array, etc.
>
> Because of the replacement of basic_string in the next (?) version of gcc, I
> am not sure it is such a good idea to export a new instantiation for it.

For user code that uses things like sregex_token_iterator (triggers
_Compiler<basic_regex<char>::const_iterator>), it saves compile time:
Without any instantiation, testsuite/performance/28_regex/split.cc
cost about 5 sec to compile in my machine; with basic_string inst, it
costs 1.5 sec to compile; with pointers insts only (in this patch), it
costs 2.8 secs. But no doubt it generates larger object file.

Originally I suggested to copy the input regex into _Compiler as a
"const _CharT*", but I really saw a 3000 regex input string, which
makes the time cost of copying not negligible.


-- 
Regards,
Tim Shen

Attachment: a.diff
Description: Text document


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