Opened 10 years ago
Last modified 6 years ago
#7494 assigned Bugs
boost::replace_all is very slow on debug build when Format size is big
Reported by: | Owned by: | Marshall Clow | |
---|---|---|---|
Milestone: | To Be Determined | Component: | string_algo |
Version: | Boost 1.45.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
Method boost::replace_all(SequenceT& Input, const Range1T& Search, const Range2T& Format) on debug build takes very long time when Format size is about 300k. On call stack I can see push_front for every char.
When I use std::find and std::replace in loop it is cca 10 times faster.
I have Boost library 1.45, Visual Studio 2010, Win7 x64 SP1, 6-core CPU.
Change History (5)
comment:1 by , 10 years ago
comment:3 by , 10 years ago
Sample code: std::wstring sInput = cca 20kB text (HTML template containing texts like "ImagePath1", "ImagePath2",...); std::wstring sFormat1 = cca 300kB text (base64 encoded image); boost::replace_all(sInput, L"ImagePath1", sFormat1); std::wstring sFormat2 = cca 300kB text (base64 encoded image); boost::replace_all(sInput, L"ImagePath2", sFormat2);
comment:4 by , 10 years ago
Sample code:
std::wstring sInput = cca 20kB text (HTML template containing texts like "ImagePath1", "ImagePath2",...); std::wstring sFormat1 = cca 300kB text (base64 encoded image); boost::replace_all(sInput, L"ImagePath1", sFormat1); std::wstring sFormat2 = cca 300kB text (base64 encoded image); boost::replace_all(sInput, L"ImagePath2", sFormat2);
deque::_Insert is used and it contains