rfc:grisu3-strtod

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:grisu3-strtod [2011/07/15 16:26] dsprfc:grisu3-strtod [2011/07/15 16:34] dsp
Line 1: Line 1:
 ====== Request for Comments: Add grisu3 strtod algorithm to PHP ====== ====== Request for Comments: Add grisu3 strtod algorithm to PHP ======
-  * Version: 1.0+  * Version: 0.9
   * Date: 2011-07-15   * Date: 2011-07-15
   * Author: David Soria Parra <dsp at php dot net>   * Author: David Soria Parra <dsp at php dot net>
Line 11: Line 11:
 is David Gays strtod algorithm. This algorithm is used in PHP and can be found in zend_strtod. Recently is David Gays strtod algorithm. This algorithm is used in PHP and can be found in zend_strtod. Recently
 Florian Loitsch found a new algorithm, called grisu3, to this problem. His algorithm is faster than David Gays algorithm. An Florian Loitsch found a new algorithm, called grisu3, to this problem. His algorithm is faster than David Gays algorithm. An
-OpenSource implementation exists [[http://code.google.com/p/double-conversion/|here]].+OpenSource implementation exists [[http://code.google.com/p/double-conversion/|here]]. The grisu3 algorithm fails in about 
 +0.5% cases. The library will fall back to David Gays algorithm in that case.
  
 ===== Proposal ===== ===== Proposal =====
Line 22: Line 23:
  
 Using grisu3 will speed up string to double and double to string conversions. In particular json_encode and json_decode Using grisu3 will speed up string to double and double to string conversions. In particular json_encode and json_decode
-of json data includign doubles will be faster. Simple microbenchmarks show about 30% faster json_decode.+of json data includign doubles will be faster. Simple microbenchmarks show about 20% faster json_decode.
  
 ===== Common Misconceptions ===== ===== Common Misconceptions =====
Line 37: Line 38:
 There is a initial patchset at http://bitbucket.org/segv/php-src There is a initial patchset at http://bitbucket.org/segv/php-src
  
-==== More about Grisu3 ====+===== More about Grisu3 =====
  
 http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/ http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/
rfc/grisu3-strtod.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1