|
Boost : |
From: Joe Gottman (jgottman_at_[hidden])
Date: 2008-02-13 20:43:40
I just discovered that the string algorithm predicate is_any_of has an
inefficient implementation. Internally it uses a std::set. There are
two problems with this. First, since the order of the characters does
not matter, std::unordered_set is probably faster. Second, the
contained set has to be copied each time the object is used in, for
instance, a split() statement. Since split can reuse a predicate
literally thousands of times when splitting a large string, this is a
lot of unnecessary copying.
Joe Gottman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk