Opened 20 years ago
Closed 19 years ago
#101 closed Support Requests (Works For Me)
regex performance issue
Reported by: | nobody | Owned by: | John Maddock |
---|---|---|---|
Milestone: | Component: | None | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
Is boost::regex_merge able to parse more than 20kb data per sec? I'm using a function like the following, and cant get it above that rate.. std::string RegExpBinReplace(LPCSTR szWhat, std::string szWhere, DWORD len, LPCSTR szReplacement) { const boost::regex e (szWhat,boost::regbase::normal); std::ostringstream t(std::ios::out | std::ios::binary); std::ostream_iterator<char, char> oi(t); boost::regex_merge(oi, szWhere.begin(), (szWhere.begin() + len), e, szReplacement); return t.str(); } Compiled with visual c++ 6, running on a AMD xp2000+...
Change History (2)
comment:2 by , 19 years ago
Status: | assigned → closed |
---|
Logged In: YES user_id=14804 A couple of points: * The current cvs code has just been updated with a much faster version, however the new version still won't improve performance for long searches, which was already substantially faster than the GNU regex library for example. * Using C++ iostreams can be rather slow, unless you are very careful: check that synch_with_stdio is false for example (otherwise the performance hit can be *huge*). * outputting the result to a string, and then copying to stdout is going to be a heck of a lot slower than just copying to output (due to memory allocation requirements) John Maddock.
Note:
See TracTickets
for help on using tickets.