In
ff7ac440afdae4370e12a1b9eb21d4b1389a861f we added trimming of whitespace,
so you could turn " 1.2.3.4 " into an A record 0x01020304. This commit made us more flexible
but also six times slower in some microbenchmarks.
This commit restores the old performance which shaves double digits percentages of time from many
benchmarks in 'speedtest', while making "make-a record" six times faster again.
RecordTextReader::RecordTextReader(const string& str, const DNSName& zone) : d_string(str), d_zone(zone), d_pos(0)
{
/* remove whitespace */
- boost::trim_if(d_string, boost::algorithm::is_space());
+ if(!d_string.empty() && ( dns_isspace(*d_string.begin()) || dns_isspace(*d_string.rbegin()) ))
+ boost::trim_if(d_string, boost::algorithm::is_space());
d_end = d_string.size();
}