mirror of
https://github.com/boostorg/conversion.git
synced 2025-08-02 14:04:28 +02:00
@@ -318,15 +318,11 @@ Eliminate an overhead of <code>std::locale</code> if your program runs in the "C
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h2><a name="performance">Performance</a></h2>
|
<h2><a name="performance">Performance</a></h2>
|
||||||
This table shows the execution speed for 100000 iterations in milliseconds of the following code blocks:
|
This table shows the execution time in milliseconds for 100000 calls of the following string formatters:
|
||||||
|
|
||||||
<table border="1" width="100%">
|
<table border="1" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>From->To</td><td> <code>target = lexical_cast<Target>(source);</code> </td>
|
<tr><td>From->To</td><td> <code>lexical_cast</code> </td><td><code>std::stringstream</code><br>with construction</td><td><code>std::stringstream</code><br>without construction</td><td><code>sscanf</code>/<code>sprintf</code></td></tr>
|
||||||
<td><code>std::stringstream ss;<br>ss << source;<br> ss >> target;</code></td>
|
|
||||||
<td><code>ss << source;<br> ss >> target;<br>ss.str(std::string());<br>ss.clear();</code></td>
|
|
||||||
<td><code>sscanf( (const char*)source, <...>, &target);</code> <br>OR<br> <code>sprintf( (char*)buffer, <...>, source);<br>
|
|
||||||
target = buffer;</code></td></tr>
|
|
||||||
<tr><td>string->char</td><td bgcolor="#00C000"><1</td><td>91</td><td>7</td><td>10</td></tr>
|
<tr><td>string->char</td><td bgcolor="#00C000"><1</td><td>91</td><td>7</td><td>10</td></tr>
|
||||||
<tr><td>string->int</td><td bgcolor="#00C000">7</td><td>115</td><td>23</td><td>18</td></tr>
|
<tr><td>string->int</td><td bgcolor="#00C000">7</td><td>115</td><td>23</td><td>18</td></tr>
|
||||||
<tr><td>string->unsigned int</td><td bgcolor="#00C000">7</td><td>117</td><td>22</td><td>17</td></tr>
|
<tr><td>string->unsigned int</td><td bgcolor="#00C000">7</td><td>117</td><td>22</td><td>17</td></tr>
|
||||||
|
Reference in New Issue
Block a user