[Boost-bugs] [Boost C++ Libraries] #5350: Patch for lexical_cast: additional optimizations

Subject: [Boost-bugs] [Boost C++ Libraries] #5350: Patch for lexical_cast: additional optimizations
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-03-21 19:25:48


#5350: Patch for lexical_cast: additional optimizations
---------------------------------------------------+------------------------
 Reporter: Antony Polukhin <antoshkka@…> | Owner: nasonov
     Type: Patches | Status: new
Milestone: To Be Determined | Component: lexical_cast
  Version: Boost Development Trunk | Severity: Optimization
 Keywords: |
---------------------------------------------------+------------------------
 Patch to Boost Lexical Cast library, that returns Target directly
 constructed from Source in cases, when:[[BR]]
 1) Source and Target are arithmetics (and not char or wchar_t), and all
 values of Source are in range of Target[[BR]]
 2) Source and Target are both char or both wchar_t[[BR]]
 3) Source is array of CharT and Target is std::basic_string<CharT,
 ...>[[BR]]
 4) Source and Target are std::basic_string with same template
 parameters[[BR]]

 It gives performance boost more than 10 times in case 1), about 7 times in
 case 2), and about 1.5 times in cases 3) and 4).

 Existing tests for Boost Lexical Cast library cover considered cases.
 Patch was successfully tested on Intel 11.1.072, g++-4.4.5, VC++9
 compilers.

 It has the same behaviour, when casting out of bounds (int -> unsigned
 int, int -> short, unsigned int -> int). For checking bounds it uses
 boost::numeric::conversion_traits from
 <boost/numeric/conversion/conversion_traits.hpp>

 Closes the ticket #4397[[BR]]

 Was discussed at [http://lists.boost.org/Archives/boost/2011/03/178882.php
 Boost mailing list]

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5350>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC